Switch from Map to Set

pull/120/merge
Fabrice Weinberg 8 years ago
parent b5216999f3
commit d7dbecc993

@ -74,7 +74,7 @@ export default function tag ( parser ) {
}
const attributes = [];
const uniqueNames = new Map();
const uniqueNames = new Set();
let attribute;
while ( attribute = readAttribute( parser, uniqueNames ) ) {
@ -139,11 +139,11 @@ function readAttribute ( parser, uniqueNames ) {
const name = parser.readUntil( /(\s|=|\/|>)/ );
if ( !name ) return null;
if ( uniqueNames.has(name) ) {
if ( uniqueNames.has( name ) ) {
parser.error( 'Attributes need to be unique', start );
}
uniqueNames.set(name, true);
uniqueNames.add( name );
parser.allowWhitespace();

Loading…
Cancel
Save