[whatwg] MessageEvent.domain, document.domain on a page whose URI has no domain (e.g. data:text/html, ...)

Michael A. Puls II shadow2531 at gmail.com
Thu Jan 24 04:20:04 PST 2008


On 1/23/08, Jeff Walden <jwalden+whatwg at mit.edu> wrote:
> The spec as currently written says that document.domain in a document located at a URI with no domain is null:
>
> data:text/html,<script>alert(document.domain);</script>
>
> Safari and Opera both alert the empty string for this

I like Safari and Opera's way because .domain always returns a string,
which makes sense to me from a type perspective (at least in
javascript).

However, Firefox is probably right because in the case of no domain,
there's no domain string to return, so null is returned. This is also
what PHP's DOMDocument->domain returns.

Just would be nice if all browsers did the same here.

-- 
Michael



More information about the whatwg mailing list