Prev: What is a software engineer?
Next: Java Front end Developer | NYC | Long term (Only GC/Citizens)
From: David Mark on 27 Nov 2009 04:22 On Nov 27, 3:35 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: [...] > > Alas, the DOM 2 HTML specification does not standardize it that way. Not > even for img.src. > I know, but there definitely should be. The browser developers are mostly in agreement at this time (e.g. Opera 9.5+, Chrome, Safari 4, IE6-8, and most if not all FF versions). How else would you (easily) get the resolved path? That's why I couldn't believe HTML5 would consider going in the other direction (URI properties and attributes _both_ return unresolved paths).
From: Garrett Smith on 27 Nov 2009 14:45 David Mark wrote: > On Nov 27, 3:35 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: > > [...] > >> Alas, the DOM 2 HTML specification does not standardize it that way. Not >> even for img.src. >> > > I know, but there definitely should be. It is not standard. Browsers vary for many properties. The browser developers are > mostly in agreement at this time (e.g. Opera 9.5+, Chrome, Safari 4, > IE6-8, and most if not all FF versions). > For img.src Netscape 4 provides a full URI. Other browsers copied that. For other URI attributes, browsers vary. -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: David Mark on 27 Nov 2009 15:02 On Nov 27, 2:45 pm, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: > David Mark wrote: > > On Nov 27, 3:35 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: > > > [...] > > >> Alas, the DOM 2 HTML specification does not standardize it that way. Not > >> even for img.src. > > > I know, but there definitely should be. > > It is not standard. Browsers vary for many properties. > > The browser developers are > > > mostly in agreement at this time (e.g. Opera 9.5+, Chrome, Safari 4, > > IE6-8, and most if not all FF versions). I meant mostly in agreement with URI attributes. The URI properties are all over the place. > > For img.src Netscape 4 provides a full URI. Other browsers copied that. Generally a.href as well. The idea that they would split the remaining URI properties up into resolve and "no resolve" piles is ridiculous. ISTM that properties should always resolve as else there would be no way to get the resolved URI. > For other URI attributes, browsers vary. Not with attributes of late. Else that test page would have red spots on the right.
From: Garrett Smith on 27 Nov 2009 16:39 David Mark wrote: > On Nov 27, 2:45 pm, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: >> David Mark wrote: >>> On Nov 27, 3:35 am, Garrett Smith <dhtmlkitc...(a)gmail.com> wrote: >>> [...] >>>> Alas, the DOM 2 HTML specification does not standardize it that way. Not >>>> even for img.src. >>> I know, but there definitely should be. >> It is not standard. Browsers vary for many properties. >> Rereading HTML 5 on "reflects"[1] requires a URI-valued content attribute's corresponding property to have absolute URI. | If a reflecting IDL attribute is a DOMString attribute whose content | attribute is defined to contain a URL, then on getting, the IDL | attribute must resolve the value of the content attribute relative to | the element and return the resulting absolute URL if that was | successful, or the empty string otherwise; and on setting, must set | the content attribute to the specified literal value. If the content | attribute is absent, the IDL attribute must return the default value, | if the content attribute has one, or else the empty That means that all URI valued properties, form.action, link.href, script.src, etc would return an absolute URL (or "" if that fails). >> The browser developers are >> >>> mostly in agreement at this time (e.g. Opera 9.5+, Chrome, Safari 4, >>> IE6-8, and most if not all FF versions). > > I meant mostly in agreement with URI attributes. Attribute value is whatever is in the source code, unless the property "reflects". In that case, changing the property changes the attribute value and vice versa. For example, setting the title property actually creates the title attribute value: var node = document.createElement("div"); node.getAttribute("title"); // null node.title="t"; node.getAttribute("title"); // "t" The style property has a more involved serialization. The URI properties > are all over the place. > >> For img.src Netscape 4 provides a full URI. Other browsers copied that. > > Generally a.href as well. a.href is required to return absolute URI per DOM 2 HTML. The same spec says img.src is a URI but does not say if that should be relative or absolute: http://www.w3.org/TR/DOM-Level-2-HTML/html.html#ID-87762984 | src of type DOMString | URI [IETF RFC 2396] designating the source of this image. See the | src attribute definition in HTML 4.01. The idea that they would split the > remaining URI properties up into resolve and "no resolve" piles is > ridiculous. ISTM that properties should always resolve as else there > would be no way to get the resolved URI. > >> For other URI attributes, browsers vary. > disambiguation: For other URI-valued attributes, values of corresponding DOM properties vary between browsers. HTML 5 defines "reflect" specially for URI-valued attributes/properties, as stated (and explained in the reflink below). [1]http://www.whatwg.org/specs/web-apps/current-work/multipage/urls.html#reflecting-content-attributes-in-idl-attributes -- Garrett comp.lang.javascript FAQ: http://jibbering.com/faq/
From: Eric Bednarz on 27 Nov 2009 17:35
Garrett Smith <dhtmlkitchen(a)gmail.com> writes: > Attribute value is whatever is in the source code, Since there are numerous people posting to this group who appear to think that SGML validation is a relevant tool for HTML QA, I am delighted to say that you are wrong about that. :-) In the source code – of HTML documents, at least – are attribute value *literals*. |