W3C home > Mailing lists > Public > whatwg@whatwg.org > January 2008

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

From: Michael A. Puls II <shadow2531@gmail.com>
Date: Thu, 24 Jan 2008 07:20:04 -0500
Message-ID: <6b9c91b20801240420y910fa0fybf4433a86a04545c@mail.gmail.com>
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
Received on Thursday, 24 January 2008 04:20:04 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:00 UTC