W3C home > Mailing lists > Public > www-forms@w3.org > September 2006

Re: some technical thoughts about incremental improvements to forms

From: Dave Raggett <dsr@w3.org>
Date: Tue, 5 Sep 2006 10:04:07 +0100 (BST)
To: Lachlan Hunt <lachlan.hunt@lachy.id.au>
Cc: Doug Schepers <doug.schepers@vectoreal.com>, www-forms@w3.org
Message-ID: <Pine.LNX.4.64.0609050911580.5310@holly>

For text/html, IE applies special parsing rules for HTML elements
because unfortunately there are many websites with malformed markup. 
For non HTML elements it honor's the /> syntax, unlike Firefox and
Opera. I don't have a Mac and hence wasn't able to test Safari.

Thus for the following markup:

-------------8< cut here---------------
<?xml version="1.0" encoding="utf-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://example.com/eforms" xml:lang="en" lang="en">
<title>Mixed markup test</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" 
<script src="test.js" type="text/javascript">
<style type="text/css">
   f\:model { display: none; visibility: hidden }
   f\:field { display: block }
<h1>Mixed markup test</h1>

<bind id="b1" name="fred"/>

<f:model id="form">hello</f:model>

<f:field ref="form/name1">Given Name</f:field>
<f:field ref="form/name2">Family Name</f:field>

<f:submit id="submit" ref="form"/>

This form is written in custom XML.

-------------8< cut here---------------

IE6 gives the following DOM for the body element:

       Mixed markup test

       Given Name

       Family Name

     This form is written in custom XML

The above was obtained by using a script to walk through the DOM 
tree for document.body. The script just used the nodeName for
the tags and on IE this means you don't get to see the namespace
prefixes. Note that the bind element is shown as upper case because
it isn't in an XML namespace. The original case is preserved if
the element has a namespace, e.g.

        <h:bind id="b1" name="fred"/>

where h has to have been bound to a namespace URI. Firefox and Opera 
treat "/>" as if it was ">". Firefox also forces all elements to 
uppercase. Opera doesn't. It seems that browser developers aren't 
particularly thorough in reverse engineering IE's behavior in 
parsing well formed markup.

My point is that if all browsers honored the /> syntax for non HTML 
elements delivered as text/html and preserved the case, it would 
make it that much easier to deploy mixed markup documents. 
Currently, you have to patch up the DOM tree for Firefox and Opera
to recover the intended document structure.

  Dave Raggett <dsr@w3.org>  W3C lead for multimodal interaction
  http://www.w3.org/People/Raggett +44 1225 866240 (or 867351)
Received on Tuesday, 5 September 2006 09:04:14 UTC

This archive was generated by hypermail 2.3.1 : Tuesday, 6 January 2015 21:36:18 UTC