* Strips <![CDATA[]]> from content because it should be used * there in most cases for XHTML compliance. * @param {String} original Input code. * @return {String} Returns code without leading <![CDATA[]]> tags.
(original)
| 1089 | * @return {String} Returns code without leading <![CDATA[]]> tags. |
| 1090 | */ |
| 1091 | function stripCData(original) |
| 1092 | { |
| 1093 | var left = '<![CDATA[', |
| 1094 | right = ']]>', |
| 1095 | // for some reason IE inserts some leading blanks here |
| 1096 | copy = trim(original), |
| 1097 | changed = false, |
| 1098 | leftLength = left.length, |
| 1099 | rightLength = right.length |
| 1100 | ; |
| 1101 | |
| 1102 | if (copy.indexOf(left) == 0) |
| 1103 | { |
| 1104 | copy = copy.substring(leftLength); |
| 1105 | changed = true; |
| 1106 | } |
| 1107 | |
| 1108 | var copyLength = copy.length; |
| 1109 | |
| 1110 | if (copy.indexOf(right) == copyLength - rightLength) |
| 1111 | { |
| 1112 | copy = copy.substring(0, copyLength - rightLength); |
| 1113 | changed = true; |
| 1114 | } |
| 1115 | |
| 1116 | return changed ? copy : original; |
| 1117 | }; |
| 1118 | |
| 1119 | |
| 1120 | /** |