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 = getAllPropertyNames(element); |
21 tagProperties[tag] = properties; | 21 tagProperties[tag] = properties; |
22 if (isCommonProperty === null) { | 22 if (commonProperties === null) { |
23 isCommonProperty = {}; | 23 commonProperties = {}; |
24 properties.forEach(function(property) { | 24 properties.forEach(function(property) { |
25 isCommonProperty[property] = true; | 25 commonProperties[property] = true; |
26 }); | 26 }); |
27 } else { | 27 } else { |
28 var hasProperty = {}; | 28 var hasProperty = {}; |
29 properties.forEach(function(property) { | 29 properties.forEach(function(property) { |
30 hasProperty[property] = true; | 30 hasProperty[property] = true; |
31 }); | 31 }); |
32 Object.getOwnPropertyNames(isCommonProperty).forEach(function(proper
ty) { | 32 Object.getOwnPropertyNames(commonProperties).forEach(function(proper
ty) { |
33 if (!hasProperty[property]) | 33 if (!hasProperty[property]) |
34 delete isCommonProperty[property]; | 34 delete commonProperties[property]; |
35 }); | 35 }); |
36 } | 36 } |
37 }); | 37 }); |
38 debug(escapeHTML('<common>')); | 38 debug(escapeHTML('<common>')); |
39 Object.getOwnPropertyNames(isCommonProperty).sort().forEach(function(propert
y) { | 39 Object.getOwnPropertyNames(commonProperties).sort().forEach(function(propert
y) { |
40 debug(' property ' + property); | 40 debug(' property ' + property); |
41 }); | 41 }); |
42 tags.forEach(function(tag) { | 42 tags.forEach(function(tag) { |
43 debug(type + ' element ' + tag); | 43 debug(type + ' element ' + tag); |
44 tagProperties[tag].forEach(function(property) { | 44 tagProperties[tag].forEach(function(property) { |
45 if (!isCommonProperty[property]) | 45 if (!(property in commonProperties)) |
46 debug(' property ' + property); | 46 debug(' property ' + property); |
47 }); | 47 }); |
48 }); | 48 }); |
49 } | 49 } |
50 | 50 |
51 listElementProperties('html'); | 51 listElementProperties('html'); |
52 listElementProperties('svg'); | 52 listElementProperties('svg'); |
53 | 53 |
54 })(); | 54 })(); |
OLD | NEW |