LEFT | RIGHT |
1 // Copyright (C) 2008 Google Inc. | 1 // Copyright (C) 2008 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 189 } |
190 | 190 |
191 private void extractScripts(Node node, Jobs jobs) { | 191 private void extractScripts(Node node, Jobs jobs) { |
192 switch (node.getNodeType()) { | 192 switch (node.getNodeType()) { |
193 case Node.ELEMENT_NODE: | 193 case Node.ELEMENT_NODE: |
194 Element el = (Element) node; | 194 Element el = (Element) node; |
195 Block extracted = ExtractedHtmlContent.extractedScriptFor(el); | 195 Block extracted = ExtractedHtmlContent.extractedScriptFor(el); |
196 if (extracted != null) { | 196 if (extracted != null) { |
197 int jobNum = jobs.getJobs().size(); | 197 int jobNum = jobs.getJobs().size(); |
198 el.setAttribute("jobnum", "" + jobNum); | 198 el.setAttribute("jobnum", "" + jobNum); |
199 jobs.getJobs().add(new Job(new AncestorChain<Block>(extracted))); | 199 jobs.getJobs().add(new Job(AncestorChain.instance(extracted))); |
200 } | 200 } |
201 for (Node c = el.getFirstChild(); c != null; c = c.getNextSibling()) { | 201 for (Node c = el.getFirstChild(); c != null; c = c.getNextSibling()) { |
202 extractScripts(c, jobs); | 202 extractScripts(c, jobs); |
203 } | 203 } |
204 break; | 204 break; |
205 case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_NODE: | 205 case Node.DOCUMENT_FRAGMENT_NODE: case Node.DOCUMENT_NODE: |
206 for (Node c = node.getFirstChild(); c != null; c = c.getNextSibling()) { | 206 for (Node c = node.getFirstChild(); c != null; c = c.getNextSibling()) { |
207 extractScripts(c, jobs); | 207 extractScripts(c, jobs); |
208 } | 208 } |
209 break; | 209 break; |
210 } | 210 } |
211 } | 211 } |
212 } | 212 } |
LEFT | RIGHT |