Skip to content
Permalink
Browse files

Merge branch 't/11536' into major

  • Loading branch information...
mlewand committed Feb 10, 2014
2 parents 5875583 + fc6c798 commit da5e23cada2a7f0a3e05aa512249338c399691c7
Showing with 15 additions and 3 deletions.
  1. +1 −0 CHANGES.md
  2. +14 −3 core/tools.js
@@ -5,6 +5,7 @@ CKEditor 4 Changelog

New Features:

* [#11536](http://dev.ckeditor.com/ticket/11536): Added CKEDITOR.tools.htmlDecode method.
* [#11377](http://dev.ckeditor.com/ticket/11377): Unify internal representation of empty anchors using fake objects.
* [#11225](http://dev.ckeditor.com/ticket/11225): Introduced the [`CKEDITOR.tools.transparentImageData`](http://localhost/cksource/ckeditor-docs/build/#!/api/CKEDITOR.tools-property-transparentImageData) property which contains transparent image data to be used in CSS or as images' source.

@@ -325,11 +325,22 @@
return String( text ).replace( /&/g, '&amp;' ).replace( />/g, '&gt;' ).replace( /</g, '&lt;' );
},

/**
* Decodes HTML entities.
*
* alert( CKEDITOR.tools.htmlDecode( '&lt;a &amp; b &gt;' ) ); // '<a & b >'
*
* @param {String} The string to be decoded.
* @returns {String} The decoded string.
*/
htmlDecode: function( text ) {
return text.replace( /&amp;/g, '&' ).replace( /&gt;/g, '>' ).replace( /&lt;/g, '<' );
},

/**
* Replaces special HTML characters in HTMLElement attribute with their relative HTML entity values.
*
* element.setAttribute( 'title', '<a " b >' );
* alert( CKEDITOR.tools.htmlEncodeAttr( element.getAttribute( 'title' ) ); // '&gt;a &quot; b &lt;'
* alert( CKEDITOR.tools.htmlEncodeAttr( '<a " b >' ) ); // '&lt;a &quot; b &gt;'
*
* @param {String} The attribute value to be encoded.
* @returns {String} The encoded value.
@@ -343,7 +354,7 @@
* {@link #htmlEncodeAttr htmlEncodeAttr} back to their plain character
* representation.
*
* alert( CKEDITOR.tools.htmlDecodeAttr( '&gt;a &quot; b &lt;' ); // '<a " b >'
* alert( CKEDITOR.tools.htmlDecodeAttr( '&lt;a &quot; b&gt;' ) ); // '<a " b>'
*
* @param {String} text The text to be decoded.
* @returns {String} The decoded text.

0 comments on commit da5e23c

Please sign in to comment.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.