| OLD | NEW |
| 1 (function() { | 1 (function() { |
| 2 | 2 |
| 3 if (!window.internals) { | 3 if (!window.internals) { |
| 4 testFailed('Test must be run with --expose-internals-for-testing flag.'); | 4 testFailed('Test must be run with --expose-internals-for-testing flag.'); |
| 5 return; | 5 return; |
| 6 } | 6 } |
| 7 | 7 |
| 8 // FIXME(https://crbug.com/43394): | 8 // FIXME(https://crbug.com/43394): |
| 9 // These properties should live in the element prototypes instead of on the indi
vidual instances. | 9 // These properties should live in the element prototypes instead of on the indi
vidual instances. |
| 10 function listElementProperties(type) { | 10 function listElementProperties(type) { |
| 11 debug('[' + type.toUpperCase() + ' NAMESPACE ELEMENT PROPERTIES]'); | 11 debug('[' + type.toUpperCase() + ' NAMESPACE ELEMENT PROPERTIES]'); |
| 12 var namespace = internals[type + 'Namespace'](); | 12 var namespace = internals[type + 'Namespace'](); |
| 13 debug('namespace ' + namespace); | 13 debug('namespace ' + namespace); |
| 14 var tags = internals[type + 'Tags'](); | 14 var tags = internals[type + 'Tags'](); |
| 15 var tagProperties = {}; | 15 var tagProperties = {}; |
| 16 var isCommonProperty = null; // Will be a map containing the intersection of
properties across all elements as keys. | 16 var commonProperties = null; // Will be a map containing the intersection of
properties across all elements as keys. |
| 17 tags.forEach(function(tag) { | 17 tags.forEach(function(tag) { |
| 18 var element = document.createElement(tag, namespace); | 18 var element = document.createElement(tag, namespace); |
| 19 // We don't read out the property descriptors here to avoid the test tim
ing out. | 19 // We don't read out the property descriptors here to avoid the test tim
ing out. |
| 20 var properties = Object.getOwnPropertyNames(element).sort(); | 20 var properties = []; |
| 21 for (var property in element) { |
| 22 properties.push(property); |
| 23 } |
| 24 properties.sort(); |
| 21 tagProperties[tag] = properties; | 25 tagProperties[tag] = properties; |
| 22 if (isCommonProperty === null) { | 26 if (commonProperties === null) { |
| 23 isCommonProperty = {}; | 27 commonProperties = {}; |
| 24 properties.forEach(function(property) { | 28 properties.forEach(function(property) { |
| 25 isCommonProperty[property] = true; | 29 commonProperties[property] = true; |
| 26 }); | 30 }); |
| 27 } else { | 31 } else { |
| 28 var hasProperty = {}; | 32 var hasProperty = {}; |
| 29 properties.forEach(function(property) { | 33 properties.forEach(function(property) { |
| 30 hasProperty[property] = true; | 34 hasProperty[property] = true; |
| 31 }); | 35 }); |
| 32 Object.getOwnPropertyNames(isCommonProperty).forEach(function(proper
ty) { | 36 Object.getOwnPropertyNames(commonProperties).forEach(function(proper
ty) { |
| 33 if (!hasProperty[property]) | 37 if (!hasProperty[property]) |
| 34 delete isCommonProperty[property]; | 38 delete commonProperties[property]; |
| 35 }); | 39 }); |
| 36 } | 40 } |
| 37 }); | 41 }); |
| 38 debug(escapeHTML('<common>')); | 42 debug(escapeHTML('<common>')); |
| 39 Object.getOwnPropertyNames(isCommonProperty).sort().forEach(function(propert
y) { | 43 Object.getOwnPropertyNames(commonProperties).sort().forEach(function(propert
y) { |
| 40 debug(' property ' + property); | 44 debug(' property ' + property); |
| 41 }); | 45 }); |
| 42 tags.forEach(function(tag) { | 46 tags.forEach(function(tag) { |
| 43 debug(type + ' element ' + tag); | 47 debug(type + ' element ' + tag); |
| 44 tagProperties[tag].forEach(function(property) { | 48 tagProperties[tag].forEach(function(property) { |
| 45 if (!isCommonProperty[property]) | 49 if (!(property in commonProperties)) |
| 46 debug(' property ' + property); | 50 debug(' property ' + property); |
| 47 }); | 51 }); |
| 48 }); | 52 }); |
| 49 } | 53 } |
| 50 | 54 |
| 51 listElementProperties('html'); | 55 listElementProperties('html'); |
| 52 listElementProperties('svg'); | 56 listElementProperties('svg'); |
| 53 | 57 |
| 54 })(); | 58 })(); |
| OLD | NEW |