@@ -99,7 +99,55 @@ var DOM = {
9999 for ( f in d ) d . hasOwnProperty ( f ) && a . addEventListener ( f , d [ f ] , ! 1 ) ;
100100 if ( e ) for ( f in e ) e . hasOwnProperty ( f ) && ( a [ f ] = e [ f ] ) ;
101101 return a ;
102- } ,
102+ } , parse : function ( html ) {
103+ // based on jQuery.buildFragment()
104+ //
105+ // jQuery JavaScript Library v1.11.3
106+ // http://jquery.com/
107+ //
108+ // Copyright 2005, 2014 jQuery Foundation, Inc. and other contributors
109+ // Released under the MIT license
110+ // http://jquery.org/license
111+ var rxhtmlTag = / < (? ! a r e a | b r | c o l | e m b e d | h r | i m g | i n p u t | l i n k | m e t a | p a r a m ) ( ( [ \w : ] + ) [ ^ > ] * ) \/ > / gi,
112+ rtagName = / < ( [ \w : ] + ) / ,
113+ rhtml = / < | & # ? \w + ; / ,
114+ wrapMap = {
115+ option : [ 1 , "<select multiple='multiple'>" , "</select>" ] ,
116+ legend : [ 1 , "<fieldset>" , "</fieldset>" ] ,
117+ area : [ 1 , "<map>" , "</map>" ] ,
118+ param : [ 1 , "<object>" , "</object>" ] ,
119+ thead : [ 1 , "<table>" , "</table>" ] ,
120+ tr : [ 2 , "<table><tbody>" , "</tbody></table>" ] ,
121+ col : [ 2 , "<table><tbody></tbody><colgroup>" , "</colgroup></table>" ] ,
122+ td : [ 3 , "<table><tbody><tr>" , "</tr></tbody></table>" ] ,
123+ _default : [ 0 , "" , "" ]
124+ } ,
125+ nodes = [ ] ;
126+ wrapMap . optgroup = wrapMap . option , wrapMap . th = wrapMap . td ,
127+ wrapMap . tbody = wrapMap . tfoot = wrapMap . colgroup = wrapMap . caption = wrapMap . thead ;
128+
129+ if ( ! rhtml . test ( html ) ) {
130+ // Convert non-html into a text node
131+ return document . createTextNode ( html ) ;
132+ } else {
133+ // Convert html into DOM nodes
134+ var tmp = document . createElement ( 'div' ) ;
135+
136+ // Deserialize a standard representation
137+ var tag = ( rtagName . exec ( html ) || [ "" , "" ] ) [ 1 ] . toLowerCase ( ) ;
138+ var wrap = wrapMap [ tag ] || wrapMap . _default ;
139+
140+ tmp . innerHTML = wrap [ 1 ] + html . replace ( rxhtmlTag , "<$1></$2>" ) + wrap [ 2 ] ;
141+
142+ // Descend through wrappers to the right content
143+ var j = wrap [ 0 ] + 1 ;
144+ while ( j -- ) {
145+ tmp = tmp . lastChild ;
146+ }
147+
148+ return tmp ;
149+ }
150+ } ,
103151 append : function ( a , b , c , d , e , f , g ) {
104152 var h ;
105153 a = a
@@ -757,7 +805,14 @@ var DOM = {
757805 } ,
758806 iterateArray : function ( a , b ) {
759807 Array . isArray ( a ) && a . forEach ( b ) ;
760- }
808+ } , isEmpty : function ( object ) {
809+ for ( var key in object ) {
810+ if ( object . hasOwnProperty ( key ) ) {
811+ return false ;
812+ }
813+ }
814+ return true ;
815+ }
761816 } ,
762817 VAL = {
763818 choose : function ( a ) {
@@ -826,7 +881,17 @@ var DOM = {
826881 return (
827882 ( - 1 < a . indexOf ( "k" ) ? 1e3 : 1 ) * parseInt ( a . replace ( / [ ^ \d ] / g, "" ) , 10 )
828883 ) ;
829- }
884+ } , parseIntRess : function ( a ) {
885+ var r ;
886+ a = STR . trim ( ( a . match ( / : ( [ ^ < ] + ) * / ) ? a . match ( / : ( [ ^ < ] + ) * / ) [ 1 ] : a ) ) ;
887+ if ( a . match ( / ^ [ 0 - 9 ] { 1 , 3 } \. [ 0 - 9 ] { 3 } $ / ) )
888+ a = a . replace ( '.' , '' ) ;
889+ else if ( ( r = new RegExp ( '^([0-9]{1,3}(\.|,))?[0-9]{1,3}(' + AGO . Label . is ( "KU0B" ) + ')' ) ) && a . match ( r ) )
890+ a = a . replace ( / , / g, '.' ) . replace ( AGO . Label . is ( "KU0B" ) , '' ) * 1000000000 ;
891+ else if ( ( r = new RegExp ( '^([0-9]{1,3}(\.|,))?[0-9]{1,3}(' + AGO . Label . is ( "KU0M" ) + ')' ) ) && a . match ( r ) )
892+ a = a . replace ( / , / g, '.' ) . replace ( AGO . Label . is ( "KU0M" ) , '' ) * 1000000 ;
893+ return parseInt ( a ) ;
894+ }
830895 } ,
831896 STR = {
832897 check : function ( a ) {
@@ -912,5 +977,12 @@ var DOM = {
912977 for ( b = { } , a = a . split ( "&" ) , d = 0 ; d < a . length ; d ++ )
913978 ( c = ( a [ d ] || "" ) . split ( "=" ) ) , c [ 0 ] && ( b [ c [ 0 ] ] = c [ 1 ] || "" ) ;
914979 return b ;
915- }
980+ } , getMatches : function ( string , regex , index ) {
981+ index || ( index = 1 ) ; // default to the first capturing group
982+ var matches = [ ] ;
983+ var match ;
984+ while ( match = regex . exec ( string ) )
985+ matches . push ( match [ index ] ) ;
986+ return matches ;
987+ }
916988 } ;
0 commit comments