conforming to changes following #25

Selector result is now a list, instead of a Set
This commit is contained in:
Wouter Scherphof 2013-12-10 13:31:17 +01:00
parent a4c3dd3e3b
commit 3539e0505b

View File

@ -30,12 +30,12 @@ Or in shorthand:
```lua ```lua
local elements = root(selectorstring) local elements = root(selectorstring)
``` ```
This wil return a [Set][1] of elements, all of which are of the same type as the root element, and thus support selecting as well, if ever needed: This wil return a list of elements, all of which are of the same type as the root element, and thus support selecting as well, if ever needed:
```lua ```lua
for e in pairs(elements) do for _,e in ipairs(elements) do
print(e.name) print(e.name)
local subs = e(subselectorstring) local subs = e(subselectorstring)
for sub in pairs(subs) do for _,sub in ipairs(subs) do
print("", sub.name) print("", sub.name)
end end
end end
@ -76,6 +76,7 @@ All tree elements provide, apart from `:select` and `()`, the following accessor
- `.parent` the elements that contains this element; `root.parent` is `nil` - `.parent` the elements that contains this element; `root.parent` is `nil`
###Other ###Other
- `.index` sequence number of elements in order of appearance; root index is `0`
- `:gettext()` the complete element text, starting with `"<tagname"` and ending with `"/>"` or `"</tagname>"` - `:gettext()` the complete element text, starting with `"<tagname"` and ending with `"/>"` or `"</tagname>"`
- `.level` how deep the element is in the tree; root level is `0` - `.level` how deep the element is in the tree; root level is `0`
- `.root` the root element of the tree; `root.root` is `root` - `.root` the root element of the tree; `root.root` is `root`