On May 18, 2008, at 5:58 PM, Maciej Stachowiak wrote:

While I'm on the topic, I'm also curious about that [XXX] placeholder. There's a bug in WebKit's bugzilla pointing out that the IE8 beta and Firefox 2 both support `delete storage.keyName` syntax as an alias for `storage.removeItem(keyName)` I'm taking a guess here and assuming supporting the `delete` syntax is the implied concept behind [XXX]

WebKit's JavaScript engine doesn't currently have the ability to run custom code when a property is deleted. It would be a significant challenge to add this capability and possibly a performance regression; and no other DOM-related spec requires this, even when there is NameGetter or IndexGetter behavior. For example NodeLists and HTMLCollections do not let you delete by name to remove the item (I'm not sure what that would even mean). So I'd prefer not to have to introducethis concept just for this one case.

WebKit has the ability to add custom property deletion on a per- class basis - therefore not slowing down the common case at all. That's how I fixed the bug to make us compatible with IE8 and Firefox for now as this debate gets underway...

I know there are other outstanding questions about how wise it is to introduce custom behavior for deleting properties for specific objects versus the common case. I don't have a good enough feel for all of the concerns with javascript and DOM scripting to know if this is a "horrible" idea, or just kind of a weird idea.

At this stage, I'm not necessarily arguing whether or not the HTML5 spec should adopt this behavior or not, be it in the HTML5 spec itself or by WebIDL specifying the custom behavior. But in the real world, if IE8 and Firefox continue to have this behavior but strict standards following browsers don't, then that's an unfortunate incompatibility.

Also note that unlike IE8 beta and WebKit nightlies and other unreleased browsers who are still implementing this for the first time, Firefox has apparently had the behavior since Firefox 2.0

My instinct is that if the community decides it is "just kind of weird", then it is a useful shorthand that we wouldn't lose anything from standardizing on.

~Brady

Regards,
Maciej


Reply via email to