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);     } } 

fiddle

being little more fancy

var el  = document.createelement('body'),     arr = object.keys(document.body).filter(function(prop) {         return !(prop in el);     }); 

Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -