Skip to content

Commit 725f629

Browse files
author
@soyjavi
committed
Set selector in instance
1 parent 3fc75f1 commit 725f629

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

source/quo.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ Quo = do ->
9999
# ---------------------------------------------------------------------------
100100
_instance = (dom, selector = "") ->
101101
dom = dom or EMPTY_ARRAY
102+
dom.selector = selector
102103
dom.__proto__ = _instance::
103-
dom.__proto__.selector = selector or ""
104104
dom
105105

106106
_getDOMObject = (selector, children) ->

spec/8_output.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ describe "Output", ->
3131
expect(el.html()).toEqual markup
3232

3333

34-
it "can ser html value to a given element", ->
34+
it "can set html value to a given element", ->
3535
new_markup = "<aside></aside>"
3636
el.html new_markup
3737
expect(el.html()).toEqual new_markup

spec/9_query.coffee

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ describe "Output", ->
1717

1818
it "can get the parent of each element in the current instance", ->
1919
children = el.find "header"
20-
expect(children.parent()).toEqual el
20+
expect(children.parent().html()).toEqual el.html()
2121

2222

2323
it "can get the children of each element in the current instance", ->
2424
children = el.children()
2525
header = $$ "section > header"
26-
expect(children).toEqual header
26+
expect(children.html()).toEqual header.html()
2727

2828
el.append "<footer></footer>"
2929
children = el.children("header")
30-
expect(children).toEqual header
30+
expect(children.html()).toEqual header.html()
3131

3232

3333
it "can retrieve the DOM elements matched by the QuoJS object.", ->
@@ -53,18 +53,18 @@ describe "Output", ->
5353
it "can get the first element that matches the selector by testing the element itself and traversing up through its ancestors", ->
5454
header = $$ "section header"
5555
dom = header.closest "section"
56-
expect(dom).toEqual el
56+
expect(dom.html()).toEqual el.html()
5757

5858

5959
it "can get the immediately following sibling of each element in the instance", ->
6060
el.append "<footer></footer>"
6161
header = $$ "section header"
6262
footer = $$ "section footer"
63-
expect(header.next()).toEqual footer
63+
expect(header.next().html()).toEqual footer.html()
6464

6565

6666
it "can get the immediately preceding sibling of each element in the instance", ->
6767
el.append "<footer></footer>"
6868
header = $$ "section header"
6969
footer = $$ "section footer"
70-
expect(footer.prev()).toEqual header
70+
expect(footer.prev().html()).toEqual header.html()

0 commit comments

Comments
 (0)