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

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: rebase Created 7 years, 6 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 logCurrentScript();
34 </script>
35
36 <script id="defer-1" defer src="resources/log-current-script.js"></script>
37 <script id="e" src="resources/log-current-script.js"></script>
38
39
40 <script id="f">
41 logCurrentScript();
42 document.write('<script id="g" src="resources/log-current-script.js"><\/script>' );
43 logCurrentScript();
44 </script>
45
46 <script id="h">
47 logCurrentScript();
48 document.write('<script id="defer-2" defer src="resources/log-current-script.js" ><\/script>');
49 logCurrentScript();
50 </script>
51
52 <script id="i">
53 logCurrentScript();
54
55 var script = document.createElement('script');
56 script.id = 'j';
57 script.textContent = 'logCurrentScript();';
58 script.async = false;
59 script.defer = false;
60 document.head.appendChild(script);
61
62 logCurrentScript();
63 </script>
64
65 <script src="../../js/resources/js-test-post.js"></script>
66 <script>
67 window.onload = function() {
68 shouldBeNull('document.currentScript');
69 finishJSTest();
70 };
71 </script>
72 </body>
73 </html>
74
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/fast/dom/Document/document-current-script-async.html » ('j') | Source/core/dom/ScriptElement.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698