javascript - Get all custom DOM properties -
i attaching dom properties element dynamically so:
i = 0; document.body['a' + i] = "foo"; document.body['b' + i] = "bar"; is there way can of properties attached array? example:
var allproperties = ['a0', 'b0']; thanks!
you can create new body object, , compare against object properties not added browser
i = 0; document.body['a' + i] = "foo"; document.body['b' + i] = "bar"; var el = document.createelement('body'), arr = []; (var key in document.body) { if (document.body.hasownproperty(key) && !(key in el)) { arr.push(key); } } being little more fancy
var el = document.createelement('body'), arr = object.keys(document.body).filter(function(prop) { return !(prop in el); });
Comments
Post a Comment