Last Comment Bug 235409 - XPointer element scheme doesn't work with XHTML media type
: XPointer element scheme doesn't work with XHTML media type
Status: RESOLVED WONTFIX
: testcase, xhtml
Product: Core
Classification: Components
Component: XML (show other bugs)
: Trunk
: All All
: -- normal with 3 votes (vote)
: ---
Assigned To: Heikki Toivonen (remove -bugzilla when emailing directly)
:
: Andrew Overholt [:overholt]
Mentors:
http://www.w3.org/TR/xptr-element/
Depends on:
Blocks: xpointer
  Show dependency treegraph
 
Reported: 2004-02-24 03:39 PST by Xanthor Sccas
Modified: 2011-01-26 18:54 PST (History)
13 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments

Description Xanthor Sccas 2004-02-24 03:40:00 PST
User-Agent:       
Build Identifier: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7a) Gecko/20040212 Firebird/0.8.0+

As shown with the testcase of bug 182323, XPointer framework and element scheme
and extensible element scheme registration work with text/xml files.
But when we try with XHTML files with the application/xhtml+xml media type
instead of text/xml, it doesn't work..

Reproducible: Always
Steps to Reproduce:
1. Open a XHTML file with the application/xhtml+xml media type
2. Try to access an element with #element()

Or
1. Test http://www.tomoakley.net/xml/xhtml.xhtml#element(definitions)
2. Compare with http://www.tomoakley.net/xml/xhtml.xhtml#definitions
Actual Results:  
Nothing occures

Expected Results:  
The same behaviour than with text/xml type (the page scrolls until the position
of the element)
Comment 1 Heikki Toivonen (remove -bugzilla when emailing directly) 2004-02-24 10:34:45 PST
Confirmed. Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
Comment 2 Boris Zbarsky [:bz] (still a bit busy) 2004-02-24 11:34:45 PST
See
http://lxr.mozilla.org/seamonkey/source/layout/html/base/src/nsPresShell.cpp#3986

That probably needs to be hoisted up to nsIDocument (and just do nothing in HTML
but not XHTML docs).
Comment 3 Boris Zbarsky [:bz] (still a bit busy) 2004-02-24 17:26:48 PST
Hrm.. except this is scriptable...

Should this move to a separate interface of its own and be implemented by XHTML
documents too?
Comment 4 Chapman Flack 2008-02-22 12:21:27 PST
I'm not familiar enough with the code structure to know how easy or hard
it is to do the right thing, but it's clear what the right thing is: XPointer
is intended to work with any document format that is backed by XML.
It should certainly work in xhtml documents, whether they are served as
application/xml, text/xml, application/xhtml+xml, or even text/html, as
described in
http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/
.

Of course that means, for text/html, that you need to look at more
than just the supplied content-type (because old soupy html can
also be served with the same content type).  Pointers should also
work in any application/foo+xml type, and other documents that have
their own registered content-types but are known to be xml.  Again,
I can't suggest the best way to make that happen, or how difficult
it would be as the existing code is structured - but anything short
of that would be an arbitrary limitation.
Comment 5 Boris Zbarsky [:bz] (still a bit busy) 2008-02-22 21:29:17 PST
> It should certainly work in xhtml documents, whether they are served as
> application/xml, text/xml, application/xhtml+xml, or even text/html

I don't think that last is the case.  A document served with that type is not treated as XHTML in any way; it's treated as HTML (which it is).
Comment 6 Chapman Flack 2008-02-25 09:22:09 PST
>> application/xml, text/xml, application/xhtml+xml, or even text/html

> I don't think that last is the case.  A document served with that type is not
> treated as XHTML in any way; it's treated as HTML (which it is).

I can see a few different things that might mean:

1. Stuff that comes under a text/html content type is never XHTML, and
   always only HTML. (A claim on fact, but not always true, because
   http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/
   allows text/html as one of the content types for serving an XHTML
   doc).

2. Stuff that comes under a text/html content type *should never be
   treated as* XHTML, but always only as HTML. (A claim on what *should*
   be done.) The media-types note could be read this way (after all, it
   says such documents "will not be processed as XML, e.g.
   well-formedness errors may not be detected by user agents). I read
   it more as a caution to authors than a prohibition to implementors,
   though: the point of choosing text/html is to make your content
   available to the widest audience of browsers, some of which won't
   process it as XML so you can't count on that.  But a browser that
   does grok XML and can see that what it received under the text/html
   content type is XHTML does not seem forbidden to use that knowledge
   (though it may have to apply HTML rules for DOM, style sheets, and
   encodings).

3. Stuff that comes under a text/html content type *is not treated
   as XHTML in any way by our implementation as it stands* (a claim
   on existing implementation details). That may well be the case,
   and your sense is better than mine for how deep that limitation
   might run.

Bringing that back to the question "what should be done with XPointer,"
I think it helps to ask "what is XPointer for?"  A huge benefit of
XPointer is an easy way to point at specific places in content served
by others without depending on special effort on their part. It comes
closest to fulfilling its promise when it works *in as many
circumstances as it possibly can* - that is, wherever the underlying
content can be treated as XML.

Authors could moot this point for XHTML by always using content
negotiation to call their stuff application/xhtml+xml for browsers that
understand it, and only calling it text/html for browsers that don't,
as in http://www.w3.org/2003/01/xhtml-mimetype/content-negotiation. But
that's another example of special author effort, and another example
where it's a bigger win if the author can neglect to do that and it
doesn't stop other people from writing pointers that work anyway.
Comment 7 Boris Zbarsky [:bz] (still a bit busy) 2008-02-25 09:41:11 PST
> Stuff that comes under a text/html content type *should never be
> treated as* XHTML, but always only as HTML.

This is correct.  As long as the data follows Appendix C of the XHTML specification, this will mostly work, but DOM compatibility is pretty broken between XHTML-as-XHTML and XHTML-as-HTML in all sorts of way (much more serious than whether xpointer works; consider the child nodes of <table> issue).

> that is, wherever the underlying content can be treated as XML.

A data stream that has been parsed with the tag-soup parser like any other tag-soup is tag-soup.  Nothing to do with XML.  Note that the vast majority of "xhtml" documents out there (which are served as text/html) aren't even well-formed XML.... so treating them as XML is a non-starter.
Comment 8 Boris Zbarsky [:bz] (still a bit busy) 2011-01-26 18:54:35 PST
This looks like wontfix; we dropped xpointer entirely a few years ago.

Note You need to log in before you can comment on or make changes to this bug.