Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[e] (0) Rewrite how we patch XPath 1.0 for HTML5.
Fixing http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059

git-svn-id: http://svn.whatwg.org/webapps@4007 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Sep 28, 2009
1 parent 432bf14 commit 359c1cf
Show file tree
Hide file tree
Showing 2 changed files with 122 additions and 26 deletions.
71 changes: 58 additions & 13 deletions index
Expand Up @@ -112,7 +112,7 @@
<div class=head>
<p><a class=logo href=http://www.whatwg.org/ rel=home><img alt=WHATWG src=/images/logo></a></p>
<h1>HTML5</h1>
<h2 class="no-num no-toc" id=draft-standard-&mdash;-27-september-2009>Draft Standard &mdash; 27 September 2009</h2>
<h2 class="no-num no-toc" id=draft-standard-&mdash;-28-september-2009>Draft Standard &mdash; 28 September 2009</h2>
<p>You can take part in this work. <a href=http://www.whatwg.org/mailing-list>Join the working group's discussion list.</a></p>
<p><strong>Web designers!</strong> We have a <a href=http://blog.whatwg.org/faq/>FAQ</a>, a <a href=http://forums.whatwg.org/>forum</a>, and a <a href=http://www.whatwg.org/mailing-list#help>help mailing list</a> for you!</p>
<!--<p class="impl"><strong>Implementors!</strong> We have a <a href="http://www.whatwg.org/mailing-list#implementors">mailing list</a> for you too!</p>-->
Expand Down Expand Up @@ -9366,18 +9366,63 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0

<p id=xpath-1.0-processors>Implementations of XPath 1.0 that
operate on HTML documents parsed or created in the manners described
in this specification (e.g. as part of the <code title="">document.evaluate()</code> API) are affected as
follows:</p>

<p>A node test consisting of a <a href=http://www.w3.org/TR/REC-xml-names/#NT-QName>QName</a>
with no prefix (i.e. that matches the <a href=http://www.w3.org/TR/REC-xml-names/#NT-UnprefixedName>UnprefixedName</a>
production) must be treated as if it instead had the namespace URI
equal to <a href=#html-namespace-0>HTML namespace</a> when the node is an element
whose document is an <a href=#html-documents title="HTML documents">HTML
document</a>. <a href=#refsXPATH10>[XPATH10]</a> <a href=#refsXMLNS>[XMLNS]</a></p>

<p class=note>This requirement is a <a href=#willful-violation>willful violation</a>
of the XPath 1.0 specification, motivated by desire to have
in this specification (e.g. as part of the <code title="">document.evaluate()</code> API) must act as if the
following edit was applied to the XPath 1.0 specification.</p>

<p>First, remove this paragraph:</p>

<blockquote cite=http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests>

<p>A <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> in the
node test is expanded into an <a href=http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name>expanded-name</a>
using the namespace declarations from the expression context. This
is the same way expansion is done for element type names in start
and end-tags except that the default namespace declared with <code title="">xmlns</code> is not used: if the <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> does
not have a prefix, then the namespace URI is null (this is the same
way attribute names are expanded). It is an error if the <a href=http://www.w3.org/TR/REC-xml-names#NT-QName>QName</a> has a
prefix for which there is no namespace declaration in the
expression context.</p>

</blockquote>

<p>Then, insert in its place the following:</p>

<blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">

<p>A QName in the node test is expanded into an expanded-name using
the namespace declarations from the expression context. If the
QName has a prefix, then there must be namespace declaration for
this prefix in the expression context, and the correponding
namespace URI is the one that is associated with this prefix. It
is an error if the QName has a prefix for which there is no
namespace declaration in the expression context. </p>

<p>If the QName has no prefix and the principal node type of the
axis is element, then the default element namespace is
used. Otherwise if the QName has no prefix, the namespace URI is
null. The default element namespace is a member of the context for
the XPath expression. The value of the default element namespace
when executing an XPath expression through the DOM3 XPath API is
determined in the following way:</p>

<ol><li>If the context node is from an HTML DOM, the default element
namespace is "http://www.w3.org/1999/xhtml".</li>

<li>Otherwise, the default element namespace URI is null.</li>

</ol><p class=note>This is equivalent to adding the default element
namespace feature of XPath 2.0 to XPath 1.0, and using the HTML
namespace as the default element namespace for HTML documents. It
is motivated by the desire to have implementations be compatible
with legacy HTML content while still supporting the changes that
this specification introduces to HTML regarding the namespace used
for HTML elements, and by the desire to use XPath 1.0 rather than
XPath 2.0.</p>

</blockquote>

<p class=note>This change is a <a href=#willful-violation>willful violation</a> of
the XPath 1.0 specification, motivated by desire to have
implementations be compatible with legacy content while still
supporting the changes that this specification introduces to HTML
regarding which namespace is used for HTML elements. <a href=#refsXPATH10>[XPATH10]</a></p> <!-- note: version matters for
Expand Down
77 changes: 64 additions & 13 deletions source
Expand Up @@ -9682,21 +9682,72 @@ http://software.hixie.ch/utilities/js/live-dom-viewer/?%3C%21DOCTYPE%20HTML%3E%0
<p id="xpath-1.0-processors">Implementations of XPath 1.0 that
operate on HTML documents parsed or created in the manners described
in this specification (e.g. as part of the <code
title="">document.evaluate()</code> API) are affected as
follows:</p>
title="">document.evaluate()</code> API) must act as if the
following edit was applied to the XPath 1.0 specification.</p>

<p>First, remove this paragraph:</p>

<blockquote cite="http://www.w3.org/TR/1999/REC-xpath-19991116#node-tests">

<p>A <a
href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> in the
node test is expanded into an <a
href="http://www.w3.org/TR/1999/REC-xpath-19991116#dt-expanded-name">expanded-name</a>
using the namespace declarations from the expression context. This
is the same way expansion is done for element type names in start
and end-tags except that the default namespace declared with <code
title="">xmlns</code> is not used: if the <a
href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> does
not have a prefix, then the namespace URI is null (this is the same
way attribute names are expanded). It is an error if the <a
href="http://www.w3.org/TR/REC-xml-names#NT-QName">QName</a> has a
prefix for which there is no namespace declaration in the
expression context.</p>

</blockquote>

<p>Then, insert in its place the following:</p>

<blockquote cite="http://www.w3.org/Bugs/Public/show_bug.cgi?id=7059#c37">

<p>A QName in the node test is expanded into an expanded-name using
the namespace declarations from the expression context. If the
QName has a prefix, then there must be namespace declaration for
this prefix in the expression context, and the correponding
namespace URI is the one that is associated with this prefix. It
is an error if the QName has a prefix for which there is no
namespace declaration in the expression context. </p>

<p>If the QName has no prefix and the principal node type of the
axis is element, then the default element namespace is
used. Otherwise if the QName has no prefix, the namespace URI is
null. The default element namespace is a member of the context for
the XPath expression. The value of the default element namespace
when executing an XPath expression through the DOM3 XPath API is
determined in the following way:</p>

<p>A node test consisting of a <a
href="http://www.w3.org/TR/REC-xml-names/#NT-QName">QName</a>
with no prefix (i.e. that matches the <a
href="http://www.w3.org/TR/REC-xml-names/#NT-UnprefixedName">UnprefixedName</a>
production) must be treated as if it instead had the namespace URI
equal to <span>HTML namespace</span> when the node is an element
whose document is an <span title="HTML documents">HTML
document</span>. <a href="#refsXPATH10">[XPATH10]</a> <a
href="#refsXMLNS">[XMLNS]</a></p>
<ol>

<p class="note">This requirement is a <span>willful violation</span>
of the XPath 1.0 specification, motivated by desire to have
<li>If the context node is from an HTML DOM, the default element
namespace is "http://www.w3.org/1999/xhtml".</li>

<li>Otherwise, the default element namespace URI is null.</li>

</ol>

<p class="note">This is equivalent to adding the default element
namespace feature of XPath 2.0 to XPath 1.0, and using the HTML
namespace as the default element namespace for HTML documents. It
is motivated by the desire to have implementations be compatible
with legacy HTML content while still supporting the changes that
this specification introduces to HTML regarding the namespace used
for HTML elements, and by the desire to use XPath 1.0 rather than
XPath 2.0.</p>

</blockquote>

<p class="note">This change is a <span>willful violation</span> of
the XPath 1.0 specification, motivated by desire to have
implementations be compatible with legacy content while still
supporting the changes that this specification introduces to HTML
regarding which namespace is used for HTML elements. <a
Expand Down

0 comments on commit 359c1cf

Please sign in to comment.