[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 matches.forEach(function(m) 2 { 3 // Test whether this is an end tag 4 var isEnd = (text[m[0][1] + 1] === '/'); 5 6 var pos = m[0][1], 7 len = m[0][0].length, 8 elName = m[2 - isEnd][0].toLowerCase(); 9 10 // Use the element's alias if applicable, or the name of the element (with the 11 // configured prefix) otherwise 12 var tagName = (config.aliases && config.aliases[elName] && config.aliases[elName]['']) 13 ? config.aliases[elName][''] 14 : config.prefix + ':' + elName; 15 16 if (isEnd) 17 { 18 addEndTag(tagName, pos, len); 19 20 return; 21 } 22 23 // Test whether it's a self-closing tag or a start tag. 24 // 25 // A self-closing tag will become one start tag consuming all of the text followed by a 26 // 0-width end tag. Alternatively, it could be replaced by a pair of 0-width tags plus 27 // an ignore tag to prevent the text in between from being output 28 var tag = (/(<\S+|['"\s])\/>$/.test(m[0][0])) 29 ? addTagPair(tagName, pos, len, pos + len, 0) 30 : addStartTag(tagName, pos, len); 31 32 captureAttributes(tag, elName, m[3][0]); 33 }); 34 35 /** 36 * Capture all attributes in given string 37 * 38 * @param {!Tag} tag Target tag 39 * @param {!string} elName Name of the HTML element 40 * @param {!string} str String containing the attribute declarations 41 */ 42 function captureAttributes(tag, elName, str) 43 { 44 // Capture attributes 45 var attrRegexp = /[a-z][-a-z0-9]*(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s"'=<>`]+))?/gi, 46 attrName, 47 attrValue, 48 attrMatch, 49 pos; 50 51 while (attrMatch = attrRegexp.exec(str)) 52 { 53 pos = attrMatch[0].indexOf('='); 54 55 /** 56 * If there's no equal sign, it's a boolean attribute and we generate a value equal 57 * to the attribute's name, lowercased 58 * 59 * @link http://www.w3.org/html/wg/drafts/html/master/single-page.html#boolean-attributes 60 */ 61 if (pos < 0) 62 { 63 pos = attrMatch[0].length; 64 attrMatch[0] += '=' + attrMatch[0].toLowerCase(); 65 } 66 67 // Normalize the attribute name, remove the whitespace around its value to account 68 // for cases like <b title = "foo"/> 69 attrName = attrMatch[0].substr(0, pos).toLowerCase().replace(/^\s+/, '').replace('/\s+$/', ''); 70 attrValue = attrMatch[0].substr(1 + pos).replace(/^\s+/, '').replace('/\s+$/', ''); 71 72 // Use the attribute's alias if applicable 73 if (HINT.HTMLELEMENTS_HAS_ALIASES && config.aliases && config.aliases[elName] && config.aliases[elName][attrName]) 74 { 75 attrName = config.aliases[elName][attrName]; 76 } 77 78 // Remove quotes around the value 79 if (/^["']/.test(attrValue)) 80 { 81 attrValue = attrValue.substr(1, attrValue.length - 2); 82 } 83 84 tag.setAttribute(attrName, html_entity_decode(attrValue)); 85 } 86 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |