Skip to content

Commit e8b768f

Browse files
author
Adnan Ahmed
committed
fixed firefox crash issue
1 parent 0538884 commit e8b768f

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

dist/dom-furnish.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dom-furnish.js

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@
4141
var observer = new MutationObserver(function(mutations, observer) {
4242
mutations.forEach(function(mutation) {
4343
var target = mutation.target;
44-
furnishElement(target);
44+
target.lastClassName !== target.className && furnishElement(target);
45+
target.lastClassName = target.className;
4546
});
4647
});
4748

@@ -86,16 +87,13 @@
8687
*/
8788
function apply(observeElement) {
8889

89-
var observeElement = observeElement || window.document,
90-
observeElement = observeElement instanceof Array ? observeElement[0] : observeElement;
91-
92-
var elements = observeElement.getElementsByTagName('*');
93-
94-
for(var i in elements) {
90+
var scope = observeElement || window.document;
91+
var elements = scope.getElementsByTagName('*');
92+
for (var i in elements) {
9593
var element = elements[i];
96-
if (typeof(element) === "object") {
94+
if (typeof element === 'object') {
9795
furnishElement(element);
98-
observer.observe(element, {attributes: true });
96+
observer.observe(element, { attributes: true, attributeFilter: ['class'] });
9997
}
10098
}
10199
}

0 commit comments

Comments
 (0)