[whatwg] HTML: A DOM attribute that returns the language of a node

Peter Occil poccil14 at gmail.com
Fri Jul 12 17:19:17 PDT 2013


Well, my true hope is that such a DOM attribute like "language" will be 
specified in the HTML or DOM spec.  Especially since it's not currently 
possible to get the language of a node through JavaScript methods alone. 
See [1] and its replies.

--Peter

[1]: http://lists.w3.org/Archives/Public/public-rdfa-wg/2013May/0064.html

-----Original Message----- 
From: Ian Hickson
Sent: Friday, July 12, 2013 3:48 PM
To: Peter Occil
Cc: WHATWG
Subject: Re: [whatwg] HTML: A DOM attribute that returns the language of a 
node

On Wed, 24 Apr 2013, Peter Occil wrote:
>
> Well in my case, I have written an HTML parser in Java and C# [1][2],
> which parses HTML documents and returns an object that implements a
> subset of the DOM, so far.  As far as possible, I included only methods
> and attributes that were specified in the DOM or HTML specification,
> such as the characterSet attribute (which is called getCharacterSet on
> my DOM's IDocument interface), and more recently the innerHTML attribute
> (which is called getInnerHTML on my DOM's IElement interface)
>
> However, when I decided to implement an RDFa processor based on my HTML
> parser, I had need to include a method that returns the language of a
> node (see, for example, section 3.3 of reference [3]). As a result, I
> included a method called getLanguage on my DOM's INode interface (which
> may correspond to a possible--future--DOM attribute called "language" on
> the Node interface).  I feel uneasy having to include this extension to
> what ought to be a subset of the HTML DOM.

Implementations of HTML and the DOM are allowed to have internal methods
to do things like this. There's no reason to limit yourself to the API
visible to JavaScript.

-- 
Ian Hickson               U+1047E                )\._.,--....,'``.    fL
http://ln.hixie.ch/       U+263A                /,   _.. \   _\  ;`._ ,.
Things that are impossible just take longer.   `._.-(,_..'--(,_..'`-.;.' 




More information about the whatwg mailing list