W3C home > Mailing lists > Public > public-script-coord@w3.org > July to September 2011

[Bug 13752] Figure out what 'delete window.Node' should do

From: <bugzilla@jessica.w3.org>
Date: Mon, 29 Aug 2011 03:25:12 +0000
To: public-script-coord@w3.org
Message-Id: <E1QxsTI-00009k-Uz@jessica.w3.org>
http://www.w3.org/Bugs/Public/show_bug.cgi?id=13752

Garrett <dhtmlkitchen@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dhtmlkitchen@gmail.com

--- Comment #4 from Garrett <dhtmlkitchen@gmail.com> 2011-08-29 03:25:10 UTC ---
Here is your code:

function testInterfaceDeletable(iface) {
  test(function() {
    assert_true(!!window[iface], "Interface should exist.")
    assert_true(delete window[iface], "The delete operator should return
true.")
    assert_equals(window[iface], undefined, "Interface should be gone.")
}
 Avoid getting bit by ASI bugs by consistently using explicit semicolons where
they are required.

The delete operator does not "return" anything. The delete operator is just
what it is: an operator. It performs an operation which has a boolean result. 

test(function() {
  for (var p in window) {
    interfaces.forEach(function(i) {
      assert_not_equals(p, i)
    })
  }
}, "Interface objects properties should not be Enumerable")

If `window` is specified to have own interface objects as own properties, then
you can use:

({}).propertyIsEnumerable.call(window, "Node");

Otherwise, if interface objects can exist in `window` prototype chain,
`propertyIsEnumerable`, which doesn't check the object's prototype, won't work
there.

Does WebIDL or HTML5 specify `window` to have `Object.prototype` on its
prototype chain? If so, then the code could use
`window.propertyIsEnumerable("Node")`.

-- 
Configure bugmail: http://www.w3.org/Bugs/Public/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
Received on Monday, 29 August 2011 03:25:18 UTC

This archive was generated by hypermail 2.3.1 : Wednesday, 8 May 2013 19:30:04 UTC