Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(313)

Side by Side Diff: LayoutTests/dom/html/level1/core/documentinvalidcharacterexceptioncreatepi1.js

Issue 100433004: Sync Document.createProcessingInstruction() with spec (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: test createProcessingInstruction for HTML doc Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 1
2 /* 2 /*
3 Copyright © 2001-2004 World Wide Web Consortium, 3 Copyright © 2001-2004 World Wide Web Consortium,
4 (Massachusetts Institute of Technology, European Research Consortium 4 (Massachusetts Institute of Technology, European Research Consortium
5 for Informatics and Mathematics, Keio University). All 5 for Informatics and Mathematics, Keio University). All
6 Rights Reserved. This work is distributed under the W3C® Software License [1] i n the 6 Rights Reserved. This work is distributed under the W3C® Software License [1] i n the
7 hope that it will be useful, but WITHOUT ANY WARRANTY; without even 7 hope that it will be useful, but WITHOUT ANY WARRANTY; without even
8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 8 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
9 9
10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231 10 [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 Creating a processing instruction with an empty target should cause an INVALID_C HARACTER_ERR. 79 Creating a processing instruction with an empty target should cause an INVALID_C HARACTER_ERR.
80 80
81 * @author Curt Arnold 81 * @author Curt Arnold
82 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointe r(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR']) 82 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointe r(id('ID-258A00AF')/constant[@name='INVALID_CHARACTER_ERR'])
83 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1359 44439 83 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#ID-1359 44439
84 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointe r(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-be fore(.,':')='INVALID_CHARACTER_ERR']) 84 * @see http://www.w3.org/TR/1998/REC-DOM-Level-1-19981001/level-one-core#xpointe r(id('ID-135944439')/raises/exception[@name='DOMException']/descr/p[substring-be fore(.,':')='INVALID_CHARACTER_ERR'])
85 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525 85 * @see http://www.w3.org/Bugs/Public/show_bug.cgi?id=525
86 */ 86 */
87 function documentinvalidcharacterexceptioncreatepi1() { 87 function documentinvalidcharacterexceptioncreatepi1() {
88 var success; 88 var success;
89 if(checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi1" ) != null) return; 89 if (checkInitialization(builder, "documentinvalidcharacterexceptioncreatepi1" ) != null) return;
90 var doc; 90 var doc;
91 var badPI; 91 var badPI;
92
93 var docRef = null;
94 if (typeof(this.doc) != 'undefined') {
95 docRef = this.doc;
96 }
97 doc = load(docRef, "doc", "hc_staff");
98
99 » if(
100 »
101 » (builder.contentType == "text/html")
102 92
103 » ) { 93 var docRef = null;
104 » 94 if (typeof(this.doc) != 'undefined') {
105 » { 95 docRef = this.doc;
106 » » success = false; 96 }
107 » » try { 97 doc = load(docRef, "doc", "hc_staff");
108 badPI = doc.createProcessingInstruction("foo","data");
109 }
110 » » catch(ex) {
111 success = (typeof(ex.code) != 'undefined' && ex.code == 9);
112 » » }
113 » » assertTrue("throw_NOT_SUPPORTED_ERR",success);
114 » }
115 98
116 » } 99 success = false;
117 » 100 try {
118 » » else { 101 badPI = doc.createProcessingInstruction("","data");
119 » » » 102 } catch(ex) {
120 » {
121 » » success = false;
122 » » try {
123 badPI = doc.createProcessingInstruction("","data");
124 }
125 » » catch(ex) {
126 success = (typeof(ex.code) != 'undefined' && ex.code == 5); 103 success = (typeof(ex.code) != 'undefined' && ex.code == 5);
127 » » } 104 }
128 » » assertTrue("throw_INVALID_CHARACTER_ERR",success); 105 assertTrue("throw_INVALID_CHARACTER_ERR",success);
129 » }
130
131 » » }
132 »
133 } 106 }
134 107
135 108
136 109
137 110
138 function runTest() { 111 function runTest() {
139 documentinvalidcharacterexceptioncreatepi1(); 112 documentinvalidcharacterexceptioncreatepi1();
140 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698