comparison lib/js/urweb.js @ 1108:82ac88b4e0a7

Proper client-side attrifyString
author Adam Chlipala <adamc@hcoop.net>
date Fri, 01 Jan 2010 10:49:36 -0500
parents 118ab9641a64
children e1d738870086
comparison
equal deleted inserted replaced
1107:52571ca9b777 1108:82ac88b4e0a7
599 if (s.length > 0 && s.charAt(0) == '_') { 599 if (s.length > 0 && s.charAt(0) == '_') {
600 s = s.substring(1); 600 s = s.substring(1);
601 } else if (s.length >= 3 && s.charAt(0) == '%' && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F')) 601 } else if (s.length >= 3 && s.charAt(0) == '%' && s.charAt(1) == '5' && (s.charAt(2) == 'f' || s.charAt(2) == 'F'))
602 s = s.substring(3); 602 s = s.substring(3);
603 return decodeURIComponent(s.replace(new RegExp ("\\+", "g"), " ")); 603 return decodeURIComponent(s.replace(new RegExp ("\\+", "g"), " "));
604 }
605
606 function atr(s) {
607 return s.replace(new RegExp ("\"", "g"), "&quot;").replace(new RegExp ("&", "g"), "&amp;")
604 } 608 }
605 609
606 function ub(b) { 610 function ub(b) {
607 return b ? "1" : "0"; 611 return b ? "1" : "0";
608 } 612 }