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()
|
||||
word.push n.textContent
|
||||
@elements.push word
|
||||
n._yatta = word
|
||||
else if n.nodeType is n.ELEMENT_NODE
|
||||
element = new XmlType undefined, undefined, undefined, undefined, n
|
||||
HB.addOperation(element).execute()
|
||||
@ -140,9 +141,11 @@ module.exports = (HB)->
|
||||
that.attributes.val('class')
|
||||
@xml.__defineSetter__ 'textContent', (val)->
|
||||
# remove all nodes
|
||||
elems = that.xml.childNodes
|
||||
for elem in elems
|
||||
that.xml.removeChild elem
|
||||
elem = that.xml.firstChild
|
||||
while elem?
|
||||
remove = elem
|
||||
elem = elem.nextSibling
|
||||
that.xml.removeChild remove
|
||||
|
||||
# insert word content
|
||||
if val isnt ""
|
||||
@ -182,6 +185,7 @@ module.exports = (HB)->
|
||||
@xml.appendChild n.val(enforce)
|
||||
else if n.type is "WordType"
|
||||
text_node = document.createTextNode n.val()
|
||||
text_node._yatta = @
|
||||
@xml.appendChild text_node
|
||||
else
|
||||
throw new Error "Internal structure cannot be transformed to dom"
|
||||
|
@ -93,8 +93,6 @@ describe "XmlFramework", ->
|
||||
@dom.classList.add "classy"
|
||||
@check()
|
||||
|
||||
|
||||
|
||||
it "supports jquery.addClass", ->
|
||||
@$dom.addClass("testy")
|
||||
@check()
|
||||
@ -124,7 +122,7 @@ describe "XmlFramework", ->
|
||||
@check()
|
||||
|
||||
it "supports jquery.empty", ->
|
||||
d = $("p")
|
||||
d = $("#test_dom p")
|
||||
d.empty()
|
||||
@check()
|
||||
|
||||
@ -136,11 +134,46 @@ describe "XmlFramework", ->
|
||||
$("<p>before span</p>").insertBefore(".span_element")
|
||||
@check()
|
||||
|
||||
it "supports jquery.insertBefore", ->
|
||||
d = $("p")
|
||||
d.empty()
|
||||
it "supports jquery.prepend", ->
|
||||
d = $("#test_dom div")
|
||||
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()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user