[whatwg] Clarification request for charset/characterSet/defaultCharset

Ian Hickson ian at hixie.ch
Tue Aug 10 15:26:05 PDT 2010


On Tue, 6 Jul 2010, Nicholas Zakas wrote:
> 
> I was just reading through the spec and am having trouble understanding 
> the details of document.charset, document.characterSet, and 
> document.defaultCharset. It seems to me that document.characterSet is 
> simply a read-only equivalent of document.charset (I'm guessing these 
> are both here due to already-existing implementations), which is a 
> little confusing but not terribly so. I'm more interested in 
> document.defaultCharset and how it relates to the others.

All three are there for historical reasons.


> Some questions:
> 
> 1) Should document.charset/document.characterSet always start out 
> equivalent to document.defaultCharset?

What do you mean by "start out"?


> 2) What is the canonical source of truth for document.defaultCharset (is 
> this a system setting, a browser setting, or a document setting)?

There is no truth to speak of for defaultCharset. The browser can return 
any arbitrary value.


> 3) If document.charset is set to a new value, is there any change 
> reflected in document.defaultCharset? What about vice-versa?

Nope. defaultCharset is read-only, so cannot be set by the author. Its 
return value can vary arbitrarily.

HTH,
-- 
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