bigskysoftware / bigskysoftware/_hyperscript
set a (same) class to a next element using the class to find the first element
- 主要语言
- JavaScript
- 星标
- 3.8k
- 派生
- 172
- PR 合并指标
- 30 天内没有已合并 PR
描述
Hello,
I have a input field and a list. the input field contains script.
When the input field is changed, the list will shift the selected class to the next element. Snippet code example:
```
```
This isn't working. Due to the `from .selected`
my understanding from thr docs:
`(next|previous) [from ] [within ] [with wrapping]`
is that after the from an expression is allowed to defined a starting point other that `me` wich is the input field and not usable.
Also my understanding of expression can be anything as from the doc:
```
Others are a bit more exotic and, for example, make it easy to work with the DOM:
ID References: #foo
Class References: .tabs
Query References:
Attribute References: @count
```
I tried to use something else like adding ID (hacking on a li the id via console) as reference and then the line works:
` add .selected to the next
However, I cannot seem to find the way to add an `ID=selected` via hyperscript.
So I am stuck.
Could you help me to clarify what the document now means concerning `expression` and if it is possible to add an id via hyperscript?
thanks in advance
贡献指南
这个仓库没有索引到贡献指南
调研方向
Start from the issue's hyperscript snippet and the documented `(next|previous) [from ] [within ]` syntax. Reproduce the `.selected` and `#selected` variants, then compare the expression and DOM-reference behavior; done means the documented syntax and a hyperscript way to identify or update the selected list item are clarified.
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript
- 领域
- frontend, web-dev
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100