From 86aeec461ae1a129acf86ccce1d006bc29bb78f2 Mon Sep 17 00:00:00 2001 From: Emily Stark Date: Tue, 17 Jun 2014 22:32:21 -0700 Subject: [PATCH] Fix canonicalizeHtml regexes. Allows empty, quoted attributes (e.g.
) --- packages/test-helpers/canonicalize_html.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/test-helpers/canonicalize_html.js b/packages/test-helpers/canonicalize_html.js index 9f6d369a78..477b1bfa0f 100644 --- a/packages/test-helpers/canonicalize_html.js +++ b/packages/test-helpers/canonicalize_html.js @@ -37,8 +37,8 @@ canonicalizeHtml = function(html) { // c="d"', assume they are separated by a single space and values // are double- or single-quoted, but allow for spaces inside the // quotes. Split on space following quote. - var attrList = attrs.replace(/(\w)='([^']+)' /g, "$1='$2'\u0000"); - attrList = attrList.replace(/(\w)="([^"]+)" /g, '$1="$2"\u0000'); + var attrList = attrs.replace(/(\w)='([^']*)' /g, "$1='$2'\u0000"); + attrList = attrList.replace(/(\w)="([^"]*)" /g, '$1="$2"\u0000'); attrList = attrList.split("\u0000"); // put attributes in alphabetical order attrList.sort();