Blame view

node_modules/jquery/src/selector/escapeSelector.js 773 Bytes
7820380e   “wangming”   1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  define( [
  	"../core"
  ], function( jQuery ) {
  
  "use strict";
  
  // CSS string/identifier serialization
  // https://drafts.csswg.org/cssom/#common-serializing-idioms
  var rcssescape = /([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g;
  
  function fcssescape( ch, asCodePoint ) {
  	if ( asCodePoint ) {
  
  		// U+0000 NULL becomes U+FFFD REPLACEMENT CHARACTER
  		if ( ch === "\0" ) {
  			return "\uFFFD";
  		}
  
  		// Control characters and (dependent upon position) numbers get escaped as code points
  		return ch.slice( 0, -1 ) + "\\" + ch.charCodeAt( ch.length - 1 ).toString( 16 ) + " ";
  	}
  
  	// Other potentially-special ASCII characters get backslash-escaped
  	return "\\" + ch;
  }
  
  jQuery.escapeSelector = function( sel ) {
  	return ( sel + "" ).replace( rcssescape, fcssescape );
  };
  
  } );