From 00f35fe41a7e6a030716daede793346356dfd9ae Mon Sep 17 00:00:00 2001
From: Jermolene
Date: Sat, 21 Mar 2015 14:17:42 +0000
Subject: [PATCH] Don't HTML encode single quotes
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
They don’t get automatically decoded when the browser reads the
resulting HTML. So, instead, we’ll solve
1e9e1a1fdc260bd8a19fa5d244590dabb5dfd7f5 by switching to double quotes
for attribute values.
---
core/modules/utils/fakedom.js | 4 ++--
core/modules/utils/utils.js | 4 ++--
editions/test/tiddlers/tests/test-widget.js | 16 ++++++++--------
editions/test/tiddlers/tests/test-wikitext.js | 2 +-
4 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/core/modules/utils/fakedom.js b/core/modules/utils/fakedom.js
index 13f162f69..0d6ea6d42 100755
--- a/core/modules/utils/fakedom.js
+++ b/core/modules/utils/fakedom.js
@@ -134,7 +134,7 @@ Object.defineProperty(TW_Element.prototype, "outerHTML", {
for(a=0; a 0) {
- output.push(" style='",style.join(""),"'")
+ output.push(" style=\"",style.join(""),"\"")
}
}
output.push(">");
diff --git a/core/modules/utils/utils.js b/core/modules/utils/utils.js
index 35bc1ff32..eed24a840 100644
--- a/core/modules/utils/utils.js
+++ b/core/modules/utils/utils.js
@@ -363,10 +363,10 @@ exports.getRelativeDate = function(delta) {
};
};
-// Convert & to "&", < to "<", > to ">", " to """ ' to "'"
+// Convert & to "&", < to "<", > to ">", " to """
exports.htmlEncode = function(s) {
if(s) {
- return s.toString().replace(/&/mg,"&").replace(//mg,">").replace(/\"/mg,""").replace(/\'/mg,"'");
+ return s.toString().replace(/&/mg,"&").replace(//mg,">").replace(/\"/mg,""");
} else {
return "";
}
diff --git a/editions/test/tiddlers/tests/test-widget.js b/editions/test/tiddlers/tests/test-widget.js
index 95536fb63..a1ad79823 100755
--- a/editions/test/tiddlers/tests/test-widget.js
+++ b/editions/test/tiddlers/tests/test-widget.js
@@ -69,7 +69,7 @@ describe("Widget module", function() {
var wrapper = renderWidgetNode(widgetNode);
describe("should render", function() {
// Test the rendering
- expect(wrapper.innerHTML).toBe("A text node
and the content of a DIV
and an inner DIV
and back in the outer DIV
");
+ expect(wrapper.innerHTML).toBe("A text node
and the content of a DIV
and an inner DIV
and back in the outer DIV
");
// Test the sequence numbers in the DOM
expect(wrapper.sequenceNumber).toBe(0);
expect(wrapper.children[0].sequenceNumber).toBe(1);
@@ -113,7 +113,7 @@ describe("Widget module", function() {
var wrapper = renderWidgetNode(widgetNode);
describe("should render", function() {
// Test the rendering
- expect(wrapper.innerHTML).toBe("A text node
and the content of a DIV
and an inner DIV
and back in the outer DIVthe quick brown fox
the quick brown fox");
+ expect(wrapper.innerHTML).toBe("A text node
and the content of a DIV
and an inner DIV
and back in the outer DIVthe quick brown fox
the quick brown fox");
// Test the sequence numbers in the DOM
expect(wrapper.sequenceNumber).toBe(0);
expect(wrapper.children[0].sequenceNumber).toBe(1);
@@ -131,7 +131,7 @@ describe("Widget module", function() {
refreshWidgetNode(widgetNode,wrapper,["TiddlerOne"]);
describe("should refresh", function() {
// Test the refreshing
- expect(wrapper.innerHTML).toBe("A text node
and the content of a DIV
and an inner DIV
and back in the outer DIVjumps over the lazy dog
jumps over the lazy dog");
+ expect(wrapper.innerHTML).toBe("A text node
and the content of a DIV
and an inner DIV
and back in the outer DIVjumps over the lazy dog
jumps over the lazy dog");
// Test the sequence numbers in the DOM
expect(wrapper.sequenceNumber).toBe(0);
expect(wrapper.children[0].sequenceNumber).toBe(1);
@@ -163,7 +163,7 @@ describe("Widget module", function() {
var wrapper = renderWidgetNode(widgetNode);
describe("should detect the recursion", function() {
// Test the rendering
- expect(wrapper.innerHTML).toBe("Recursive transclusion error in transclude widget\n");
+ expect(wrapper.innerHTML).toBe("Recursive transclusion error in transclude widget\n");
});
});
@@ -171,12 +171,12 @@ describe("Widget module", function() {
it("should deal with SVG elements", function() {
var wiki = new $tw.Wiki();
// Construct the widget node
- var text = "\n";
+ var text = "\n";
var widgetNode = createWidgetNode(parseText(text,wiki,{parseAsInline:true}),wiki);
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);
// Test the rendering
- expect(wrapper.innerHTML).toBe("\n");
+ expect(wrapper.innerHTML).toBe("\n");
expect(wrapper.firstChild.namespaceURI).toBe("http://www.w3.org/2000/svg");
});
@@ -268,7 +268,7 @@ describe("Widget module", function() {
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);
// Test the rendering
- expect(wrapper.innerHTML).toBe("
Content
");
+ expect(wrapper.innerHTML).toBe("
Content
");
});
it("should deal with built-in macros", function() {
@@ -283,7 +283,7 @@ describe("Widget module", function() {
// Render the widget node to the DOM
var wrapper = renderWidgetNode(widgetNode);
// Test the rendering
- expect(wrapper.innerHTML).toBe("