mirror of
https://github.com/meteor/meteor.git
synced 2026-05-02 03:01:46 -04:00
Use nodeType===11 for cross-browser DocumentFragment test. Thanks David.
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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("<div id=2></div>"));
|
||||
assert(true, typeof DocumentFragment !== 'undefined' ?
|
||||
ret1 instanceof DocumentFragment : ret1 instanceof HTMLDocument);
|
||||
assert(true, ret1.nodeType === 11 /* DocumentFragment */);
|
||||
assert_dump("<1></1>", ret1);
|
||||
assert_dump("<a><2></2></a>", r_a);
|
||||
assert_dump("<b><a><2></2></a></b>", r_b);
|
||||
|
||||
Reference in New Issue
Block a user