Ticket #4546: 4546.patch

File 4546.patch, 1.9 KB (added by Garry Yao, 15 years ago)
  • _source/core/tools.js

     
    267267                },
    268268
    269269                /**
     270                 * Replace characters can't be represented through CSS Selectors string
     271                 * by CSS Escape Notation where the character escape sequence consists
     272                 * of a backslash character (\) followed by the orginal characters.
     273                 * Ref: http://www.w3.org/TR/css3-selectors/#grammar
     274                 * @param cssSelectText
     275                 * @return the escaped selector text.
     276                 */
     277                escapeCssSelector : function( cssSelectText )
     278                {
     279                        return cssSelectText.replace( /[\s#:.,$*^\[\]()~=+>]/g, '\\$&' );
     280                },
     281
     282                /**
    270283                 * Gets a unique number for this CKEDITOR execution session. It returns
    271284                 * progressive numbers starting at 1.
    272285                 * @function
  • _tests/dt/core/tools.html

     
    155155                {
    156156                        assert.areSame( '   ', CKEDITOR.tools.repeat( ' ', 3 ) );
    157157                },
    158 
     158               
     159                test_escapeCssSelector : function ()
     160                {
     161                        assert.areSame( '\\.\\,\\*\\=\\~\\$\\^\\(\\)\\ \\:\\#\\+\\>', CKEDITOR.tools.escapeCssSelector( '.,*=~$^() :#+>' ) );
     162                },
     163
    159164                name : document.title
    160165        };
    161166})() );
  • _source/skins/kama/skin.js

     
    147147                                {
    148148                                        var cssContent,
    149149                                                uiStyle = addStylesheet( CKEDITOR.document ),
    150                                                 cssId = '#cke_' + editor.name.replace('.', '\\.');
     150                                                cssId = '#cke_' + CKEDITOR.tools.escapeCssSelector( editor.name );
    151151
    152152                                        var cssSelectors =
    153153                                                [
© 2003 – 2022, CKSource sp. z o.o. sp.k. All rights reserved. | Terms of use | Privacy policy