| OLD | NEW | 
|---|
|  | (Empty) | 
| 1 function getObject(interface) { |  | 
| 2     switch(interface) { |  | 
| 3         case "SVGAnimateElement": |  | 
| 4             var e = document.createElementNS("http://www.w3.org/2000/svg", "anim
    ate"); |  | 
| 5             assert_true(e instanceof SVGAnimateElement); |  | 
| 6             return e; |  | 
| 7         case "SVGAnimateMotionElement": |  | 
| 8             var e = document.createElementNS("http://www.w3.org/2000/svg", "anim
    ateMotion"); |  | 
| 9             assert_true(e instanceof SVGAnimateMotionElement); |  | 
| 10             return e; |  | 
| 11         case "SVGAnimateTransformElement": |  | 
| 12             var e = document.createElementNS("http://www.w3.org/2000/svg", "anim
    ateTransform"); |  | 
| 13             assert_true(e instanceof SVGAnimateTransformElement); |  | 
| 14             return e; |  | 
| 15         case "SVGSetElement": |  | 
| 16             var e = document.createElementNS("http://www.w3.org/2000/svg", "set"
    ); |  | 
| 17             assert_true(e instanceof SVGSetElement); |  | 
| 18             return e; |  | 
| 19     } |  | 
| 20     assert_unreached(); |  | 
| 21 } |  | 
| 22 function testSet(interface, attribute) { |  | 
| 23     test(function() { |  | 
| 24         var object = getObject(interface); |  | 
| 25         function nop() {} |  | 
| 26         assert_equals(object[attribute], null, "Initially null"); |  | 
| 27         object[attribute] = nop; |  | 
| 28         assert_equals(object[attribute], nop, "Return same function"); |  | 
| 29         object[attribute] = ""; |  | 
| 30         assert_equals(object[attribute], null, "Return null after setting string
    "); |  | 
| 31         object[attribute] = null; |  | 
| 32         assert_equals(object[attribute], null, "Finally null"); |  | 
| 33     }, "Set " + interface + "." + attribute); |  | 
| 34 } |  | 
| 35 function testReflect(interface, attribute) { |  | 
| 36     test(function() { |  | 
| 37         var element = getObject(interface); |  | 
| 38         assert_false(element.hasAttribute(attribute), "Initially missing"); |  | 
| 39         element.setAttribute(attribute, "return"); |  | 
| 40         assert_equals(element.getAttribute(attribute), "return", "Return same st
    ring"); |  | 
| 41         assert_equals(typeof element[attribute], "function", "Convert to functio
    n"); |  | 
| 42         element.removeAttribute(attribute); |  | 
| 43     }, "Reflect " + interface + "." + attribute); |  | 
| 44 } |  | 
| 45 // Object.propertyIsEnumerable cannot be used because it doesn't |  | 
| 46 // work with properties inherited through the prototype chain. |  | 
| 47 function getEnumerable(interface) { |  | 
| 48     var enumerable = {}; |  | 
| 49     for (var attribute in getObject(interface)) { |  | 
| 50         enumerable[attribute] = true; |  | 
| 51     } |  | 
| 52     return enumerable; |  | 
| 53 } |  | 
| 54 function testEventHandlerMapping(attribute, eventname) { |  | 
| 55     async_test(function(t) { |  | 
| 56         var element = getObject("SVGAnimateElement"); |  | 
| 57         assert_false(element.hasAttribute(attribute), "Initially missing"); |  | 
| 58         element[attribute] = function() { |  | 
| 59             t.step(function (){assert_true(true); t.done();}); |  | 
| 60         }; |  | 
| 61         var event = new CustomEvent(eventname); |  | 
| 62         element.dispatchEvent(event); |  | 
| 63     }, "Event " + eventname + " maps to " + attribute); |  | 
| 64 } |  | 
| 65 var enumerableCache = {}; |  | 
| 66 function testEnumerate(interface, attribute) { |  | 
| 67     if (!(interface in enumerableCache)) { |  | 
| 68         enumerableCache[interface] = getEnumerable(interface); |  | 
| 69     } |  | 
| 70     test(function() { |  | 
| 71         assert_true(enumerableCache[interface][attribute]); |  | 
| 72     }, "Enumerate " + interface + "." + attribute); |  | 
| 73 } |  | 
| OLD | NEW | 
|---|