diff options
| -rw-r--r-- | NEWS | 4 | ||||
| -rw-r--r-- | lib/docx/body-reader.js | 2 | ||||
| -rw-r--r-- | test/docx/body-reader.tests.js | 6 |
3 files changed, 8 insertions, 4 deletions
@@ -1,3 +1,7 @@ +# 1.4.21 + +* Ignore w:u elements when w:val is missing. + # 1.4.20 * Emit warning instead of throwing exception when image file cannot be found for diff --git a/lib/docx/body-reader.js b/lib/docx/body-reader.js index 4bd38a9..61b198b 100644 --- a/lib/docx/body-reader.js +++ b/lib/docx/body-reader.js @@ -83,7 +83,7 @@ function BodyReader(options) { function readUnderline(element) { if (element) { var value = element.attributes["w:val"]; - return value !== "false" && value !== "0" && value !== "none"; + return value !== undefined && value !== "false" && value !== "0" && value !== "none"; } else { return false; } diff --git a/test/docx/body-reader.tests.js b/test/docx/body-reader.tests.js index 2e53200..f5c8b87 100644 --- a/test/docx/body-reader.tests.js +++ b/test/docx/body-reader.tests.js @@ -512,11 +512,11 @@ test("isUnderline is false if underline element is not present", function() { assert.deepEqual(run.isUnderline, false); }); -test("isUnderline is true if underline element is present without w:val attribute", function() { +test("isUnderline is false if underline element is present without w:val attribute", function() { var underlineXml = new XmlElement("w:u"); var runXml = runWithProperties([underlineXml]); var run = readXmlElementValue(runXml); - assert.equal(run.isUnderline, true); + assert.equal(run.isUnderline, false); }); test("isUnderline is false if underline element is present and w:val is false", function() { @@ -540,7 +540,7 @@ test("isUnderline is false if underline element is present and w:val is none", f assert.equal(run.isUnderline, false); }); -test("isUnderline is false if underline element is present and w:val is not none or falsy", function() { +test("isUnderline is true if underline element is present and w:val is not none or falsy", function() { var underlineXml = new XmlElement("w:u", {"w:val": "single"}); var runXml = runWithProperties([underlineXml]); var run = readXmlElementValue(runXml); |
