I was just going through the code of addClass function of jQuery library as i need to make a function similar to this for my own library and i came across the following line of code:
cur = elem.nodeType === 1 && ( elem.className ?
( " " + elem.className + " " ).replace( rclass, " " ) :
" "
);
This i believe returns the class of current node, i understand most part of it , until i met my menace, regex's , rclass
, now rclass
is actually /[\t\r\n\f]/g
, now if i use a ONLINE TOOL to decode this regrex, i get the following:
/[\t\r\n\f]/g
[\t\r\n\f] match a single character present in the list below
\t Tab (ASCII 9)
\r matches a carriage return (ASCII 13)
\n matches a line-feed (newline) character (ASCII 10)
\f matches a form-feed character (ASCII 12)
g modifier: global. All matches (don't return on first match)
I am not quite able to make perfect sense of the above what does the above really mean , ok i understand \t Tab
, what on earth is line-feed
and form-feed
?
THIS QUESTION neither has a accpted answer nor is it convincingly answered by any of the answer's
Thank you.
Alex-z.