raptor-dom
Advanced tools
Comparing version 1.1.0 to 1.1.1
@@ -14,3 +14,3 @@ { | ||
"dependencies": { | ||
"try-require": "^1.0.0" | ||
"raptor-pubsub": "^1.0.5" | ||
}, | ||
@@ -21,3 +21,3 @@ "devDependencies": { | ||
}, | ||
"license": "Apache License v2.0", | ||
"license": "Apache-2.0", | ||
"bin": {}, | ||
@@ -29,3 +29,3 @@ "main": "./raptor-dom-server.js", | ||
}, | ||
"version": "1.1.0" | ||
"version": "1.1.1" | ||
} |
@@ -1,3 +0,2 @@ | ||
var tryRequire = require('try-require'); | ||
var raptorPubsub = tryRequire('raptor-pubsub', require); | ||
var raptorPubsub = require('raptor-pubsub'); | ||
@@ -17,3 +16,5 @@ function getNode(el) { | ||
if (raptorPubsub) { | ||
raptorPubsub.emit('dom/beforeRemove', { el: referenceEl }); | ||
raptorPubsub.emit('dom/beforeRemove', { | ||
el: referenceEl | ||
}); | ||
} | ||
@@ -23,6 +24,6 @@ } | ||
var dom = { | ||
forEachChildEl: function (node, callback, scope) { | ||
forEachChildEl: function(node, callback, scope) { | ||
dom.forEachChild(node, callback, scope, 1); | ||
}, | ||
forEachChild: function (node, callback, scope, nodeType) { | ||
forEachChild: function(node, callback, scope, nodeType) { | ||
if (!node) { | ||
@@ -41,10 +42,10 @@ return; | ||
}, | ||
detach: function (child) { | ||
detach: function(child) { | ||
child = getNode(child); | ||
child.parentNode.removeChild(child); | ||
}, | ||
appendTo: function (newChild, referenceParentEl) { | ||
appendTo: function(newChild, referenceParentEl) { | ||
getNode(referenceParentEl).appendChild(getNode(newChild)); | ||
}, | ||
remove: function (el) { | ||
remove: function(el) { | ||
el = getNode(el); | ||
@@ -56,3 +57,3 @@ _beforeRemove(el); | ||
}, | ||
removeChildren: function (parentEl) { | ||
removeChildren: function(parentEl) { | ||
parentEl = getNode(parentEl); | ||
@@ -71,3 +72,3 @@ | ||
}, | ||
replace: function (newChild, replacedChild) { | ||
replace: function(newChild, replacedChild) { | ||
replacedChild = getNode(replacedChild); | ||
@@ -77,5 +78,5 @@ _beforeRemove(replacedChild); | ||
}, | ||
replaceChildrenOf: function (newChild, referenceParentEl) { | ||
replaceChildrenOf: function(newChild, referenceParentEl) { | ||
referenceParentEl = getNode(referenceParentEl); | ||
dom.forEachChildEl(referenceParentEl, function (childEl) { | ||
dom.forEachChildEl(referenceParentEl, function(childEl) { | ||
_beforeRemove(childEl); | ||
@@ -86,7 +87,7 @@ }); | ||
}, | ||
insertBefore: function (newChild, referenceChild) { | ||
insertBefore: function(newChild, referenceChild) { | ||
referenceChild = getNode(referenceChild); | ||
referenceChild.parentNode.insertBefore(getNode(newChild), referenceChild); | ||
}, | ||
insertAfter: function (newChild, referenceChild) { | ||
insertAfter: function(newChild, referenceChild) { | ||
referenceChild = getNode(referenceChild); | ||
@@ -102,3 +103,3 @@ newChild = getNode(newChild); | ||
}, | ||
prependTo: function (newChild, referenceParentEl) { | ||
prependTo: function(newChild, referenceParentEl) { | ||
referenceParentEl = getNode(referenceParentEl); | ||
@@ -130,2 +131,2 @@ referenceParentEl.insertBefore(getNode(newChild), referenceParentEl.firstChild || null); | ||
module.exports = dom; | ||
module.exports = dom; |
36
ready.js
@@ -31,3 +31,3 @@ /* | ||
function domReadyCallback() { | ||
for (var i=0, len=listeners.length; i<len; i++) { | ||
for (var i = 0, len = listeners.length; i < len; i++) { | ||
var listener = listeners[i]; | ||
@@ -39,4 +39,2 @@ listener[0].call(listener[1]); | ||
// Handle when the DOM is ready | ||
@@ -47,4 +45,4 @@ function domReady() { | ||
// Make sure body exists, at least, in case IE gets a little overzealous (ticket #5443). | ||
if ( !doc.body ) { | ||
return setTimeout( domReady, 1 ); | ||
if (!doc.body) { | ||
return setTimeout(domReady, 1); | ||
} | ||
@@ -61,8 +59,8 @@ // Remember that the DOM is ready | ||
function domContentLoaded() { | ||
if ( doc.addEventListener ) { | ||
doc.removeEventListener( "DOMContentLoaded", domContentLoaded, false ); | ||
if (doc.addEventListener) { | ||
doc.removeEventListener("DOMContentLoaded", domContentLoaded, false); | ||
} else { | ||
// we're here because readyState !== "loading" in oldIE | ||
// which is good enough for us to call the dom ready! | ||
doc.detachEvent( "onreadystatechange", domContentLoaded ); | ||
doc.detachEvent("onreadystatechange", domContentLoaded); | ||
} | ||
@@ -82,4 +80,4 @@ domReady(); | ||
doc.documentElement.doScroll("left"); | ||
} catch ( error ) { | ||
setTimeout( doScrollCheck, 1 ); | ||
} catch (error) { | ||
setTimeout(doScrollCheck, 1); | ||
return; | ||
@@ -97,18 +95,18 @@ } | ||
// to the readyState before the DOM is really ready | ||
if ( document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading" ) { | ||
if (document.attachEvent ? document.readyState === "complete" : document.readyState !== "loading") { | ||
// We will get here if the browser is IE and the readyState === 'complete' or the browser | ||
// is not IE and the readyState === 'interactive' || 'complete' | ||
domReady(); | ||
} else if ( doc.addEventListener ) { // Standards-based browsers support DOMContentLoaded | ||
domReady(); | ||
} else if (doc.addEventListener) { // Standards-based browsers support DOMContentLoaded | ||
// Use the handy event callback | ||
doc.addEventListener( "DOMContentLoaded", domContentLoaded, false ); | ||
doc.addEventListener("DOMContentLoaded", domContentLoaded, false); | ||
// A fallback to win.onload, that will always work | ||
win.addEventListener( "load", domContentLoaded, false ); | ||
win.addEventListener("load", domContentLoaded, false); | ||
// If IE event model is used | ||
} else if ( doc.attachEvent ) { | ||
} else if (doc.attachEvent) { | ||
// ensure firing before onload, | ||
// maybe late but safe also for iframes | ||
doc.attachEvent( "onreadystatechange", domContentLoaded ); | ||
doc.attachEvent("onreadystatechange", domContentLoaded); | ||
// A fallback to win.onload, that will always work | ||
win.attachEvent( "onload", domContentLoaded ); | ||
win.attachEvent("onload", domContentLoaded); | ||
// If IE and not a frame | ||
@@ -119,3 +117,3 @@ // continually check to see if the document is ready | ||
} catch (e) {} | ||
if ( doc.documentElement.doScroll && toplevel ) { | ||
if (doc.documentElement.doScroll && toplevel) { | ||
doScrollCheck(); | ||
@@ -122,0 +120,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Misc. License Issues
License(Experimental) A package's licensing information has fine-grained problems.
Found 1 instance in 1 package
0
0
9094
+ Addedraptor-pubsub@^1.0.5
+ Addedevents@1.1.1(transitive)
+ Addedraptor-pubsub@1.0.5(transitive)
+ Addedraptor-util@1.1.2(transitive)
- Removedtry-require@^1.0.0
- Removedtry-require@1.2.1(transitive)