fixed jquery.replaceWith

This commit is contained in:
Kevin Jahns 2014-09-30 20:10:34 +02:00
parent 1455933abb
commit 968e07a8ff
6 changed files with 34 additions and 25 deletions

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

View File

@ -9,7 +9,7 @@ _proxy = (f_name, f)->
old_f = @[f_name] old_f = @[f_name]
if old_f? if old_f?
@[f_name] = ()-> @[f_name] = ()->
if not proxy_token if not proxy_token and not @_yatta?.isDeleted()
proxy_token = true proxy_token = true
old_f.apply this, arguments old_f.apply this, arguments
f.apply this, arguments f.apply this, arguments
@ -46,7 +46,7 @@ module.exports = (HB)->
next = prev.next_cl next = prev.next_cl
### ###
super() super(uid)
if attributes? and elements? if attributes? and elements?
@saveOperation 'attributes', attributes @saveOperation 'attributes', attributes
@ -194,13 +194,8 @@ module.exports = (HB)->
@xml @xml
#
# If possible set the replace manager in the content.
# @see WordType.setReplaceManager
#
execute: ()-> execute: ()->
super super()
### ###
if not @validateSavedOperations() if not @validateSavedOperations()
return false return false
@ -230,7 +225,6 @@ module.exports = (HB)->
'elements' : @elements.getUid() 'elements' : @elements.getUid()
'tagname' : @tagname 'tagname' : @tagname
'uid' : @getUid() 'uid' : @getUid()
} }
json json

View File

@ -37,6 +37,8 @@ describe "XmlFramework", ->
@users = @yTest.users @users = @yTest.users
### ###
@test_user = @yTest.makeNewUser 0, (Connector_uninitialized []) @test_user = @yTest.makeNewUser 0, (Connector_uninitialized [])
@test_user2 = @yTest.makeNewUser 1, (Connector_uninitialized [])
@$dom = $("#test_dom") @$dom = $("#test_dom")
@dom = @$dom[0] @dom = @$dom[0]
@test_user.val(@dom) @test_user.val(@dom)
@ -44,6 +46,11 @@ describe "XmlFramework", ->
@check = ()=> @check = ()=>
dom_ = @test_user.val(true) dom_ = @test_user.val(true)
expect(dom_.outerHTML).to.equal(@dom.outerHTML) expect(dom_.outerHTML).to.equal(@dom.outerHTML)
# now test if other collaborators can parse the HB and result in the same content
hb = @test_user.HB._encode()
@test_user2.engine.applyOps(hb)
dom2 = @test_user2.val()
expect(dom_.outerHTML).to.equal(dom2.outerHTML)
done() done()
it "can transform to a new real Dom element", -> it "can transform to a new real Dom element", ->