Implement CSS.escape
Implement CSS.escape method as specified in [1]. In order to support this
use serializeIdentifier. Note that serializeIdentifier is modified to return a
boolean since if it fails we need to throw an exception.
Add a layout test based on [2]. serializeIdentifier was changed to fix these
tests.
BUG=331218
[1] https://drafts.csswg.org/cssom/#the-css.escape()-method
[2] https://github.com/mathiasbynens/CSS.escape
Review URL: https://codereview.chromium.org/1253403005
git-svn-id: svn://svn.chromium.org/blink/trunk@199580 bbb929c8-8fbe-4397-9dbb-9b2b20218538
diff --git a/third_party/WebKit/LayoutTests/css3/escape-dom-api-expected.txt b/third_party/WebKit/LayoutTests/css3/escape-dom-api-expected.txt
new file mode 100644
index 0000000..95f066c2
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/css3/escape-dom-api-expected.txt
@@ -0,0 +1,60 @@
+Test window.CSS.escape()
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS CSS.escape('\0') threw exception InvalidCharacterError: Failed to execute 'escape' on 'CSS': The string contains an invalid character..
+PASS CSS.escape('a\0') threw exception InvalidCharacterError: Failed to execute 'escape' on 'CSS': The string contains an invalid character..
+PASS CSS.escape('\0b') threw exception InvalidCharacterError: Failed to execute 'escape' on 'CSS': The string contains an invalid character..
+PASS CSS.escape('a\0b') threw exception InvalidCharacterError: Failed to execute 'escape' on 'CSS': The string contains an invalid character..
+PASS CSS.escape() threw exception TypeError: Failed to execute 'escape' on 'CSS': 1 argument required, but only 0 present..
+PASS CSS.escape(true) is "true"
+PASS CSS.escape(false) is "false"
+PASS CSS.escape(null) is "null"
+PASS CSS.escape('') is ""
+PASS CSS.escape('') is "\\1 \\2 \\1e \\1f "
+PASS CSS.escape('0a') is "\\30 a"
+PASS CSS.escape('1a') is "\\31 a"
+PASS CSS.escape('2a') is "\\32 a"
+PASS CSS.escape('3a') is "\\33 a"
+PASS CSS.escape('4a') is "\\34 a"
+PASS CSS.escape('5a') is "\\35 a"
+PASS CSS.escape('6a') is "\\36 a"
+PASS CSS.escape('7a') is "\\37 a"
+PASS CSS.escape('8a') is "\\38 a"
+PASS CSS.escape('9a') is "\\39 a"
+PASS CSS.escape('a0b') is "a0b"
+PASS CSS.escape('a1b') is "a1b"
+PASS CSS.escape('a2b') is "a2b"
+PASS CSS.escape('a3b') is "a3b"
+PASS CSS.escape('a4b') is "a4b"
+PASS CSS.escape('a5b') is "a5b"
+PASS CSS.escape('a6b') is "a6b"
+PASS CSS.escape('a7b') is "a7b"
+PASS CSS.escape('a8b') is "a8b"
+PASS CSS.escape('a9b') is "a9b"
+PASS CSS.escape('-0a') is "-\\30 a"
+PASS CSS.escape('-1a') is "-\\31 a"
+PASS CSS.escape('-2a') is "-\\32 a"
+PASS CSS.escape('-3a') is "-\\33 a"
+PASS CSS.escape('-4a') is "-\\34 a"
+PASS CSS.escape('-5a') is "-\\35 a"
+PASS CSS.escape('-6a') is "-\\36 a"
+PASS CSS.escape('-7a') is "-\\37 a"
+PASS CSS.escape('-8a') is "-\\38 a"
+PASS CSS.escape('-9a') is "-\\39 a"
+PASS CSS.escape('--a') is "--a"
+PASS CSS.escape('-_©') is "-_©"
+PASS CSS.escape('
') is "\\7f
"
+PASS CSS.escape(' ¡¢') is " ¡¢"
+PASS CSS.escape('a0123456789b') is "a0123456789b"
+PASS CSS.escape('abcdefghijklmnopqrstuvwxyz') is "abcdefghijklmnopqrstuvwxyz"
+PASS CSS.escape('ABCDEFGHIJKLMNOPQRSTUVWXYZ') is "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+PASS CSS.escape(' !xy') is "\\ \\!xy"
+PASS CSS.escape('𝌆') is "𝌆"
+PASS CSS.escape('í¼') is "í¼"
+PASS CSS.escape('í ´') is "í ´"
+PASS successfullyParsed is true
+
+TEST COMPLETE
+