* @returns {string} Returns the string representation of the element.
(element)
| 1278 | * @returns {string} Returns the string representation of the element. |
| 1279 | */ |
| 1280 | function startingTag(element) { |
| 1281 | element = jqLite(element).clone(); |
| 1282 | try { |
| 1283 | // turns out IE does not let you set .html() on elements which |
| 1284 | // are not allowed to have children. So we just ignore it. |
| 1285 | element.empty(); |
| 1286 | } catch (e) {} |
| 1287 | var elemHtml = jqLite('<div>').append(element).html(); |
| 1288 | try { |
| 1289 | return element[0].nodeType === NODE_TYPE_TEXT ? lowercase(elemHtml) : |
| 1290 | elemHtml. |
| 1291 | match(/^(<[^>]+>)/)[1]. |
| 1292 | replace(/^<([\w\-]+)/, function(match, nodeName) { return '<' + lowercase(nodeName); }); |
| 1293 | } catch (e) { |
| 1294 | return lowercase(elemHtml); |
| 1295 | } |
| 1296 | |
| 1297 | } |
| 1298 | |
| 1299 | |
| 1300 | ///////////////////////////////////////////////// |
no test coverage detected