Opened 12 years ago

Closed 12 years ago

#9971 closed Bug (invalid)

Filter's elementsName and attributesName string patterns are used as regexp

Reported by: Piotrek Koszuliński Owned by:
Priority: Normal Milestone:
Component: Core : Parser Version:
Keywords: Cc:

Description

		var filter = new CKEDITOR.htmlParser.filter();
		filter.addRules( {
			elementNames: [
				[ 'u', 'b' ],
				[ 's', '' ]
			]
		} );

		var writer = new CKEDITOR.htmlParser.basicWriter(),
			fragment = CKEDITOR.htmlParser.fragment.fromHtml( '<p><sup>A</sup><u>B</u></p>' );
		fragment.writeHtml( writer, filter );
		console.log( writer.getHtml() ); // <p><bp>A</bp><b>B</b></p>

When the expected output is:

<p><sup>A</sup><b>B</b></p>

The same happens for attributesName. IMO this is unexpected behaviour, because string is used as regexp when a true regexp can be passed too.

Change History (2)

comment:1 Changed 12 years ago by Piotrek Koszuliński

Summary: Filter's elementsName and attributesName string pattern are used as regexpFilter's elementsName and attributesName string patterns are used as regexp

comment:2 Changed 12 years ago by Piotrek Koszuliński

Resolution: invalid
Status: newclosed

It may be confusing but it is fast, cause we don't have to check if that's string or regexp. This problem should be solved by better documentation.

Note: See TracTickets for help on using tickets.
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy