Без опису

1234567891011121314151617181920
  1. // DOM-Level-1-compliant structure
  2. var NodePrototype = require('./node');
  3. var ElementPrototype = module.exports = Object.create(NodePrototype);
  4. var domLvl1 = {
  5. tagName: "name"
  6. };
  7. Object.keys(domLvl1).forEach(function(key) {
  8. var shorthand = domLvl1[key];
  9. Object.defineProperty(ElementPrototype, key, {
  10. get: function() {
  11. return this[shorthand] || null;
  12. },
  13. set: function(val) {
  14. this[shorthand] = val;
  15. return val;
  16. }
  17. });
  18. });