more jquery methods work
This commit is contained in:
parent
eb3afe9106
commit
1455933abb
4
build/browser/Frameworks/XmlFramework.min.js
vendored
4
build/browser/Frameworks/XmlFramework.min.js
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -71,6 +71,7 @@ module.exports = (HB)->
|
|||||||
HB.addOperation(word).execute()
|
HB.addOperation(word).execute()
|
||||||
word.push n.textContent
|
word.push n.textContent
|
||||||
@elements.push word
|
@elements.push word
|
||||||
|
n._yatta = word
|
||||||
else if n.nodeType is n.ELEMENT_NODE
|
else if n.nodeType is n.ELEMENT_NODE
|
||||||
element = new XmlType undefined, undefined, undefined, undefined, n
|
element = new XmlType undefined, undefined, undefined, undefined, n
|
||||||
HB.addOperation(element).execute()
|
HB.addOperation(element).execute()
|
||||||
@ -140,9 +141,11 @@ module.exports = (HB)->
|
|||||||
that.attributes.val('class')
|
that.attributes.val('class')
|
||||||
@xml.__defineSetter__ 'textContent', (val)->
|
@xml.__defineSetter__ 'textContent', (val)->
|
||||||
# remove all nodes
|
# remove all nodes
|
||||||
elems = that.xml.childNodes
|
elem = that.xml.firstChild
|
||||||
for elem in elems
|
while elem?
|
||||||
that.xml.removeChild elem
|
remove = elem
|
||||||
|
elem = elem.nextSibling
|
||||||
|
that.xml.removeChild remove
|
||||||
|
|
||||||
# insert word content
|
# insert word content
|
||||||
if val isnt ""
|
if val isnt ""
|
||||||
@ -182,6 +185,7 @@ module.exports = (HB)->
|
|||||||
@xml.appendChild n.val(enforce)
|
@xml.appendChild n.val(enforce)
|
||||||
else if n.type is "WordType"
|
else if n.type is "WordType"
|
||||||
text_node = document.createTextNode n.val()
|
text_node = document.createTextNode n.val()
|
||||||
|
text_node._yatta = @
|
||||||
@xml.appendChild text_node
|
@xml.appendChild text_node
|
||||||
else
|
else
|
||||||
throw new Error "Internal structure cannot be transformed to dom"
|
throw new Error "Internal structure cannot be transformed to dom"
|
||||||
|
@ -93,8 +93,6 @@ describe "XmlFramework", ->
|
|||||||
@dom.classList.add "classy"
|
@dom.classList.add "classy"
|
||||||
@check()
|
@check()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
it "supports jquery.addClass", ->
|
it "supports jquery.addClass", ->
|
||||||
@$dom.addClass("testy")
|
@$dom.addClass("testy")
|
||||||
@check()
|
@check()
|
||||||
@ -124,7 +122,7 @@ describe "XmlFramework", ->
|
|||||||
@check()
|
@check()
|
||||||
|
|
||||||
it "supports jquery.empty", ->
|
it "supports jquery.empty", ->
|
||||||
d = $("p")
|
d = $("#test_dom p")
|
||||||
d.empty()
|
d.empty()
|
||||||
@check()
|
@check()
|
||||||
|
|
||||||
@ -136,11 +134,46 @@ describe "XmlFramework", ->
|
|||||||
$("<p>before span</p>").insertBefore(".span_element")
|
$("<p>before span</p>").insertBefore(".span_element")
|
||||||
@check()
|
@check()
|
||||||
|
|
||||||
it "supports jquery.insertBefore", ->
|
it "supports jquery.prepend", ->
|
||||||
d = $("p")
|
d = $("#test_dom div")
|
||||||
d.empty()
|
d.prepend("<p>prepended</p>")
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.prependTo", ->
|
||||||
|
$("<p atone=false attwo=\"dtrn\" class=\"attr_node sudo su\">prepended to</p>").prependTo("#test_dom div")
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.remove", ->
|
||||||
|
d = $("#test_dom b")
|
||||||
|
d.remove()
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.removeAttr", ->
|
||||||
|
d = $(".attr_node")
|
||||||
|
d.removeAttr("attwo")
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.removeClass", ->
|
||||||
|
d = $(".attr_node")
|
||||||
|
d.removeClass("sudo")
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.attr", ->
|
||||||
|
d = $(".attr_node")
|
||||||
|
d.attr("atone", true)
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.replaceAll", ->
|
||||||
|
$("<span>New span content </span>").replaceAll("#test_dom div")
|
||||||
|
@check()
|
||||||
|
|
||||||
|
it "supports jquery.replaceWith", ->
|
||||||
|
d = $("#test_dom span")
|
||||||
|
d.replaceWith("<div>me is div again </div>")
|
||||||
@check()
|
@check()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user