Hi Will, then looks like the problem is with this check:

https://github.com/mootools/mootools-core/blob/master/Source/Slick/Slick.Finder.js#L87

As a note, why are you doing this? Why don't you use HTML?

Thank you very much for your valuable information.

Best,
--
Fábio Miranda Costa
Front-end @ Yipit.com
*twitter:* @fabiomiranda
*github:* fabiomcosta



On Sat, May 26, 2012 at 6:44 AM, Will Daniels <daniels.w...@gmail.com>wrote:

> Hi Fábio,
>
>
> On 26/05/12 04:46, Fábio M. Costa wrote:
>
>> These checks shouldn't throw any errors since they are wrapped around a
>> try
>> block. How is that happening? Do you have an example or maybe a
>> screen-shot
>> of the error so we can understand it better?
>>
>
> The errors are parser errors from the DOM, shown in the browser console,
> not javascript errors, so they are not caught by the try block.
>
>
>  I'm also curious on how you are injecting javascript on a pure XML
>> document.
>> Hope we can solve this problem.
>>
>
> Sorry I meant to imply XHTML, not actually "pure XML", but a DOM that
> doesn't tolerate non-XML markup (i.e. doesn't use a HTML parser). I'm fuzzy
> about the exact differences, this is not so much my area, but serve an
> XHTML document to Firefox with the "application/xhtml+xml" MIME Type in
> Content-Type header, include Mootools, and you will see two errors in the
> browser console from the DOM parser caused by the Slick code injecting
> invalid markup to test for IE stuff, both the same:
>
> ---
> Timestamp: 26/05/12 01:24:05
> Error: mismatched tag. Expected: </div>.
> Source File:
> Line: 1, Column: 677
> Source Code:
> <html xmlns="http://www.w3.org/1999/**xhtml <http://www.w3.org/1999/xhtml>"
> xmlns:rdf="http://www.w3.org/**1999/02/22-rdf-syntax-ns#<http://www.w3.org/1999/02/22-rdf-syntax-ns#>"
> xmlns:dc="http://purl.org/dc/**elements/1.1/<http://purl.org/dc/elements/1.1/>"
> xmlns:dct="http://purl.org/dc/**terms/ <http://purl.org/dc/terms/>"
> xmlns:sioc="http://rdfs.org/**sioc/ns# <http://rdfs.org/sioc/ns#>"
> xmlns:sioct="http://rdfs.org/**sioc/types# <http://rdfs.org/sioc/types#>"
> xmlns:content="http://purl.**org/rss/1.0/modules/content/<http://purl.org/rss/1.0/modules/content/>"
> xmlns:v="http://rdf.data-**vocabulary.org/#<http://rdf.data-vocabulary.org/#>"
> xmlns:schema="http://schema.**org/ <http://schema.org/>" xmlns:foaf="
> http://xmlns.com/**foaf/0.1/ <http://xmlns.com/foaf/0.1/>" xmlns:owl="
> http://www.w3.org/**2002/07/owl# <http://www.w3.org/2002/07/owl#>"
> xmlns:rdfs="http://www.w3.org/**2000/01/rdf-schema#<http://www.w3.org/2000/01/rdf-schema#>"
> xmlns:xsd="http://www.w3.org/**2001/XMLSchema#<http://www.w3.org/2001/XMLSchema#>"
> xmlns:xsi="http://www.w3.org/**2001/XMLSchema-instance<http://www.w3.org/2001/XMLSchema-instance>"><div
> xmlns="http://www.w3.org/1999/**xhtml <http://www.w3.org/1999/xhtml>
> ">foo</foo></
> ---
>
> You see this junk immediately following the <html> tag:
>
> <div xmlns="http://www.w3.org/1999/**xhtml <http://www.w3.org/1999/xhtml>
> ">foo</foo></
>
> That is not actually served with the content, it is caused by mootools:
>
> https://github.com/mootools/**mootools-core/blob/master/**
> Source/Slick/Slick.Finder.js#**L90<https://github.com/mootools/mootools-core/blob/master/Source/Slick/Slick.Finder.js#L90>
>
> ...and then again here...
>
> https://github.com/mootools/**mootools-core/blob/master/**
> Source/Slick/Slick.Finder.js#**L125<https://github.com/mootools/mootools-core/blob/master/Source/Slick/Slick.Finder.js#L125>
>
> (so we get two errors per page load).
>
> Viewing source in the browser, or getting the page with curl confirms it
> is not served in the HTTP content.
>
> If the document were using an HTML parser, which is more forgiving of such
> things, it would not have left any trace in the Error Console. But for
> XHTML, which - at least in Firefox - will be using a pure XML parser (or
> something very close to one, I've never actually looked at the browser's
> code), and which is kinda the whole point of XHTML in the first place, it
> is not OK to do:
>
> testNode.innerHTML = 'foo</foo>';
>
> ...and expect the parser to make sense of it without complaint.
>
> Possibly the browser should throw an exception or something, but I guess
> it is using an XML parser with an extended DOM implementation over pure XML
> (for XHTML DOM features) and maybe it is not part of that DOM spec to throw
> an exception for such things? I'm completely guessing about that, but you
> understand what I'm saying? I don't think we need to dissect the issue,
> just to fix it.
>
> If you want to reproduce, just serve a page that includes the mootools
> core script, as real XHTML, to Firefox, and look in the Error Console
> window. It happens every page load. Two errors of the form shown above and
> also as shown by the OP in this thread.
>
> Cheers!
> -Will
>

Reply via email to