Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
observer: minor additions, wip.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Jan 18, 2014
1 parent a1490ad commit 883390c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/Observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ license that can be found in the LICENSE file.
var IMPORT_LINK_TYPE = scope.IMPORT_LINK_TYPE;
var importSelector = 'link[rel=' + IMPORT_LINK_TYPE + ']';

var matches = HTMLElement.prototype.matches ||
HTMLElement.prototype.matchesSelector ||
HTMLElement.prototype.webkitMatchesSelector ||
HTMLElement.prototype.mozMatchesSelector;

var importer = scope.importer;

function handler(mutations) {
Expand All @@ -23,7 +28,10 @@ function addedNodes(nodes) {
for (var i=0, l=nodes.length, n; (i<l) && (n=nodes[i]); i++) {
if (shouldLoadNode(n)) {
// TODO(sorvell): need to add this api.
importer.addNode(node);
importer.addNode(n);
if (n.children && n.children.length) {
addedNodes(n.children);
}
}
}
}
Expand Down

0 comments on commit 883390c

Please sign in to comment.