diff --git a/packages/liveui/liveui.js b/packages/liveui/liveui.js index 9c9980725f..80b40c8020 100644 --- a/packages/liveui/liveui.js +++ b/packages/liveui/liveui.js @@ -5,8 +5,7 @@ Sky.ui = Sky.ui || {}; // the range tag to operate on. In the latter case, the range itself // will be destroyed along with its subranges. Sky.ui._cleanup = function (what, tag) { - if (typeof DocumentFragment !== 'undefined' ? - what instanceof DocumentFragment : what instanceof HTMLDocument) + if (typeof what === 'object' && what.nodeType === 11 /* DocumentFragment */) what = new Sky.ui._LiveRange(tag, what.firstChild, what.lastChild); var ranges = []; @@ -70,8 +69,7 @@ Sky.ui.render = function (render_func, events, event_data) { var frag; // Coerce to a document fragment - if (typeof DocumentFragment !== 'undefined' ? - result instanceof DocumentFragment : result instanceof HTMLDocument) + if (typeof what === 'object' && what.nodeType === 11 /* DocumentFragment */) frag = result; else if (isNode(result)) { frag = document.createDocumentFragment(); diff --git a/tests/liverange/client/liverange.js b/tests/liverange/client/liverange.js index 97a070dc09..803de985aa 100644 --- a/tests/liverange/client/liverange.js +++ b/tests/liverange/client/liverange.js @@ -99,8 +99,7 @@ var dump = function (what, tag) { ret += (is_start ? "<": "") + obj.id + ">"; }; - if (typeof DocumentFragment !== 'undefined' ? - what instanceof DocumentFragment : what instanceof HTMLDocument) { + if (typeof what === 'object' && what.nodeType === 11 /* DocumentFragment */) { if (what.firstChild) { var range = new Sky.ui._LiveRange(tag || 'a', what); range.visit(emit, emit); @@ -371,8 +370,7 @@ var test_single = function () { assert(f.lastChild, r_b.lastNode()); var ret1 = r_a.replace_contents(frag("
")); - assert(true, typeof DocumentFragment !== 'undefined' ? - ret1 instanceof DocumentFragment : ret1 instanceof HTMLDocument); + assert(true, ret1.nodeType === 11 /* DocumentFragment */); assert_dump("<1>1>", ret1); assert_dump("<2>2>", r_a); assert_dump("<2>2>", r_b);