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

Side by Side Diff: LayoutTests/fast/dom/Document/document-current-script.html

Issue 14852011: Implement document.currentScript (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: tests Created 7 years, 7 months 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
(Empty)
1 <!DOCTYPE html>
2 <body>
3 <script src="../../js/resources/js-test-pre.js"></script>
4 <script>
5
6 jsTestIsAsync = true;
7
8 description('Test basic usage of document.currentScript')
9
10 function logCurrentScript() {
11 var script = document.currentScript
12 var s = '&lt;script id="' + script.id + '"';
13 if (script.src)
14 s += ' src="..."';
15 if (script.defer)
16 s += ' defer';
17 if (script.async)
18 s += ' async';
19 s += '>';
20 debug(s);
21 }
22
23 </script>
24 <script id="a">
25 logCurrentScript();
26 </script>
27 <script id="b">
28 logCurrentScript();
29 </script>
30 <script id="c">
31 logCurrentScript();
32 document.write('<script id="d">logCurrentScript();<\/script>');
33 </script>
34
35 <script id="defer-1" defer src="resources/log-current-script.js"></script>
36 <script id="e" src="resources/log-current-script.js"></script>
37
38
39 <script id="f">
40 logCurrentScript();
41 document.write('<script id="g" src="resources/log-current-script.js"><\/script>' );
42 </script>
43
44 <script id="h">
45 logCurrentScript();
46 document.write('<script id="defer-2" defer src="resources/log-current-script.js" ><\/script>');
47 </script>
48
49 <script id="i">
50 logCurrentScript();
51
52 var script = document.createElement('script');
53 script.id = 'j';
54 script.textContent = 'logCurrentScript();';
55 script.async = false;
56 script.defer = false;
57 document.head.appendChild(script);
58
59 </script>
60
61 <script src="../../js/resources/js-test-post.js"></script>
62 <script>
63 window.onload = function() {
64 shouldBeNull('document.currentScript');
65 finishJSTest();
66 };
67 </script>
68 </body>
69 </html>
70
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Document/document-current-script-async.html » ('j') | Source/core/dom/Document.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698