X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=_source%2Fcore%2Fhtmlparser.js;h=c2252e9d1b53d1355f9a8c0b16aca9149a99f128;hb=039a051ccf3901311661022a30afd60fc38130c9;hp=748887ed871668652929e1168aa1456c7abed0ac;hpb=8761695d9b70afe75905deaac88f78c1f8aeb32d;p=ckeditor.git diff --git a/_source/core/htmlparser.js b/_source/core/htmlparser.js index 748887e..c2252e9 100644 --- a/_source/core/htmlparser.js +++ b/_source/core/htmlparser.js @@ -1,12 +1,18 @@ /* -Copyright (c) 2003-2009, CKSource - Frederico Knabben. All rights reserved. +Copyright (c) 2003-2010, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.html or http://ckeditor.com/license */ /** - * HTML text parser. - * @constructor + * Creates a {@link CKEDITOR.htmlParser} class instance. + * @class Provides an "event like" system to parse strings of HTML data. * @example + * var parser = new CKEDITOR.htmlParser(); + * parser.onTagOpen = function( tagName, attributes, selfClosing ) + * { + * alert( tagName ); + * }; + * parser.parse( '<p>Some <b>text</b>.</p>' ); */ CKEDITOR.htmlParser = function() { @@ -92,7 +98,7 @@ CKEDITOR.htmlParser = function() * @param {String} comment The comment text. * @example * var parser = new CKEDITOR.htmlParser(); - * parser.onText = function( comment ) + * parser.onComment = function( comment ) * { * alert( comment ); // e.g. " Example " * }); @@ -172,6 +178,12 @@ CKEDITOR.htmlParser = function() if ( ( tagName = parts[ 3 ] ) ) { tagName = tagName.toLowerCase(); + + // There are some tag names that can break things, so let's + // simply ignore them when parsing. (#5224) + if ( /="/.test( tagName ) ) + continue; + var attribs = {}, attribMatch, attribsPart = parts[ 4 ], @@ -201,7 +213,7 @@ CKEDITOR.htmlParser = function() } // Comment - if( ( tagName = parts[ 2 ] ) ) + if ( ( tagName = parts[ 2 ] ) ) this.onComment( tagName ); }