refactor(core): remove unused attribute utilities from DomAdapters (#32278)

PR Close #32278
This commit is contained in:
Kara Erickson
2019-08-22 16:06:15 -07:00
committed by atscott
parent c3f9893d81
commit 4908a5cffc
5 changed files with 17 additions and 35 deletions

View File

@ -107,6 +107,16 @@ export function normalizeCSS(css: string): string {
.replace(/\[(.+)=([^"\]]+)\]/g, (...match: string[]) => `[${match[1]}="${match[2]}"]`);
}
function getAttributeMap(element: any): Map<string, string> {
const res = new Map<string, string>();
const elAttrs = element.attributes;
for (let i = 0; i < elAttrs.length; i++) {
const attrib = elAttrs.item(i);
res.set(attrib.name, attrib.value);
}
return res;
}
const _selfClosingTags = ['br', 'hr', 'input'];
export function stringifyElement(el: any /** TODO #9100 */): string {
let result = '';
@ -117,7 +127,7 @@ export function stringifyElement(el: any /** TODO #9100 */): string {
result += `<${tagName}`;
// Attributes in an ordered way
const attributeMap = getDOM().attributeMap(el);
const attributeMap = getAttributeMap(el);
const sortedKeys = Array.from(attributeMap.keys()).sort();
for (const key of sortedKeys) {
const lowerCaseKey = key.toLowerCase();