X-Git-Url: https://jasonwoof.com/gitweb/?p=peach-html5-editor.git;a=blobdiff_plain;f=editor.coffee;h=440bb3e07c01000278511a9b387e1b8395bf49fd;hp=98595f193845f0130c28c5451b162840527561b7;hb=0d372f534ac3b5439d9db3ad5cfe83d9ad6801e1;hpb=345c8dc8504b3bebf0b88c8ababae1f95ecac1a8 diff --git a/editor.coffee b/editor.coffee index 98595f1..440bb3e 100644 --- a/editor.coffee +++ b/editor.coffee @@ -277,12 +277,16 @@ control_key_codes = # we react to these, but they aren't typing '9': KEY_TAB instantiate_tree = (tree, parent) -> - for c in tree + remove = [] + for c, i in tree switch c.type when TYPE_TEXT c.el = parent.ownerDocument.createTextNode c.text parent.appendChild c.el when TYPE_TAG + if c.name in ['script', 'object', 'iframe', 'link'] + # TODO put placeholders instead + remove.unshift i # TODO create in correct namespace c.el = parent.ownerDocument.createElement c.name for k, v of c.attrs @@ -291,6 +295,8 @@ instantiate_tree = (tree, parent) -> parent.appendChild c.el if c.children.length instantiate_tree c.children, c.el + for i in remove + tree.splice i, 1 traverse_tree = (tree, state, cb) -> for c in tree