From 4e2f5a59f91fb71cb0ebb240245eeb6945c114ec Mon Sep 17 00:00:00 2001 From: Domenic Denicola Date: Mon, 18 Jan 2016 23:57:42 -0500 Subject: [PATCH] Update for whatwg/url#77 This will cause the tests to fail until https://github.com/w3c/web-platform-tests/pull/2500 is merged. --- README.md | 2 +- src/url-state-machine.js | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index e076891..fa1a36c 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ whatwg-url is a full implementation of the WHATWG [URL Standard](https://url.spe ## Current Status -whatwg-url is currently up to date with the URL spec up to commit [99a85f](https://github.com/whatwg/url/tree/99a85f77e0edf2bcc9f73183eba6c50ef9706ded). +whatwg-url is currently up to date with the URL spec up to commit [af76ff](https://github.com/whatwg/url/commit/af76ff3aa15be6310b9408d416854c2370175a8f). ## API diff --git a/src/url-state-machine.js b/src/url-state-machine.js index 6ff62c8..e0cc0f6 100644 --- a/src/url-state-machine.js +++ b/src/url-state-machine.js @@ -942,14 +942,22 @@ URLStateMachine.prototype["parse" + "path"] = } else if (c === 0x9 || c === 0xA || c === 0xD) { this.parse_error = true; } else { - //TODO:If c is not a URL code point and not "%", parse error. + // TODO: If c is not a URL code point and not "%", parse error. + if (c === p("%") && (!isASCIIHex(this.input[this.pointer + 1]) || !isASCIIHex(this.input[this.pointer + 2]))) { this.parse_error = true; } - this.buffer += encodeChar(c, isDefaultEncode); + if (c === p("%") && + this.input[this.pointer + 1] === p("2") && + this.input[this.pointer + 2] === p("e")) { + this.buffer += "."; + this.pointer += 2; + } else { + this.buffer += encodeChar(c, isDefaultEncode); + } } };