dosper7 / google-code-prettify

Automatically exported from code.google.com/p/google-code-prettify
Apache License 2.0
0 stars 0 forks source link

prettify + xhtml + lang-xml causes exception in firefox #108

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Set document type etc to XHTML
2. Include a block with prettyprint and lang-xml
3. Load in Firefox

See attached file (expects prettify.js to be relative at src/
prettify.js).  Note the document is valid according to the W3C tool.

What is the expected output?  What do you see instead?

Expect to see syntax-highlighted block.  Instead, with the Error Console 
open, see the Exception:

Error: uncaught exception: [Exception... "Component returned failure code: 
0x80004003 (NS_ERROR_INVALID_POINTER) [nsIDOMNSHTMLElement.innerHTML]"  
nsresult: "0x80004003 (NS_ERROR_INVALID_POINTER)"  location: "JS frame :: 
file:///foo/prettify-bug/src/prettify.js :: o :: line 46"  data: no]

Versions:

prettify-small-3-Dec-2009
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-GB; rv:1.9.1.7) 
Gecko/20091221 Firefox/3.5.7

Doesn't seem to depend on the actual content of the prettyprinted block, 
but works fine with other language types, and works fine without the 
DOCTYPE.

Original issue reported on code.google.com by sca...@gmail.com on 18 Jan 2010 at 1:05

Attachments:

GoogleCodeExporter commented 8 years ago
Patch attached; it tries to detect if the document is XML and if so, doesn't 
try to 
add nbsps.

Note that there are other things broken when using XML document types 
(assigning to 
innerHTML, for example), but at least this gets things working on FF.

Original comment by sca...@gmail.com on 18 Jan 2010 at 4:30

Attachments:

GoogleCodeExporter commented 8 years ago
Thanks.  I will instead change
     
to the equivalent length
     

Original comment by mikesamuel@gmail.com on 19 Jul 2010 at 8:04

GoogleCodeExporter commented 8 years ago
Fixed at rev 105.

Original comment by mikesamuel@gmail.com on 19 Jul 2010 at 8:18