Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Add support for class-name asdata-hotkey-scope #55

Open
@theinterned

Description

@theinterned

Problem

Currentlydata-hotkey-scope only supports matching the (event.target i.e. the scope) as anid, this has a few limitations:

  1. I may want to specify multiple elements as the scope for my hotkey.
  2. I may need to specify an element rendered by a third part library as my scope and do not have access to set anid on that element. (This is my current actual issue).
  3. Likely there are other uses-cases where anid doesn't work as a selector...

Suggestion

Add the ability to specify a class-name instead of an id fordata-hotkey-scope.

Some possible API thoughts:

Support a 'mini selector syntax'

The API could be updated to take a# prefix (forid) or. prefix (forclass name). We could continue to treat an un-prefixed value as an id:

<buttondata-hotkey-scope=".my-scope-class-name"/><buttondata-hotkey-scope="#my-scope-id"/><buttondata-hotkey-scope="my-scope-id"/><!-- legacy support -->

Add new data-attributes:

We could adddata-hotkey-scope-class anddata-hotkey-scope-id attributes. Again we could continue to treat the existingdata-hotkey-scope as an id scope.

<buttondata-hotkey-scope-class="my-scope-class-name"/><buttondata-hotkey-scope-id="my-scope-id"/><buttondata-hotkey-scope="my-scope-id"/><!-- legacy support -->

Considerations

Why not allow full css-selector syntax?

I thought about the possibility of extendingdata-hotkey-scope to support full css selector syntax likedata-hotkey-scope="div#parent > .target-element" ... but after talking this over with@keithamus we decided the complexity and likely performance cost of such an API would not be worth it given thatid andclass name already support many use-cases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp