Index: mojo/public/dart/third_party/analyzer/lib/src/generated/testing/html_factory.dart |
diff --git a/mojo/public/dart/third_party/analyzer/lib/src/generated/testing/html_factory.dart b/mojo/public/dart/third_party/analyzer/lib/src/generated/testing/html_factory.dart |
new file mode 100644 |
index 0000000000000000000000000000000000000000..a9ac4123f6250226c20a127b58dd40484639d4d9 |
--- /dev/null |
+++ b/mojo/public/dart/third_party/analyzer/lib/src/generated/testing/html_factory.dart |
@@ -0,0 +1,63 @@ |
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
+// for details. All rights reserved. Use of this source code is governed by a |
+// BSD-style license that can be found in the LICENSE file. |
+ |
+library engine.testing.html_factory; |
+ |
+import 'package:analyzer/src/generated/html.dart'; |
+ |
+/** |
+ * Utility methods to create HTML nodes. |
+ */ |
+@deprecated |
+class HtmlFactory { |
+ static XmlAttributeNode attribute(String name, String value) { |
+ Token nameToken = stringToken(name); |
+ Token equalsToken = new Token.con1(TokenType.EQ, 0); |
+ Token valueToken = stringToken(value); |
+ return new XmlAttributeNode(nameToken, equalsToken, valueToken); |
+ } |
+ |
+ static Token gtToken() { |
+ return new Token.con1(TokenType.GT, 0); |
+ } |
+ |
+ static Token ltsToken() { |
+ return new Token.con1(TokenType.LT_SLASH, 0); |
+ } |
+ |
+ static Token ltToken() { |
+ return new Token.con1(TokenType.LT, 0); |
+ } |
+ |
+ static HtmlScriptTagNode scriptTag( |
+ [List<XmlAttributeNode> attributes = XmlAttributeNode.EMPTY_LIST]) { |
+ return new HtmlScriptTagNode(ltToken(), stringToken("script"), attributes, |
+ sgtToken(), null, null, null, null); |
+ } |
+ |
+ static HtmlScriptTagNode scriptTagWithContent(String contents, |
+ [List<XmlAttributeNode> attributes = XmlAttributeNode.EMPTY_LIST]) { |
+ Token attributeEnd = gtToken(); |
+ Token contentToken = stringToken(contents); |
+ attributeEnd.setNext(contentToken); |
+ Token contentEnd = ltsToken(); |
+ contentToken.setNext(contentEnd); |
+ return new HtmlScriptTagNode(ltToken(), stringToken("script"), attributes, |
+ attributeEnd, null, contentEnd, stringToken("script"), gtToken()); |
+ } |
+ |
+ static Token sgtToken() { |
+ return new Token.con1(TokenType.SLASH_GT, 0); |
+ } |
+ |
+ static Token stringToken(String value) { |
+ return new Token.con2(TokenType.STRING, 0, value); |
+ } |
+ |
+ static XmlTagNode tagNode(String name, |
+ [List<XmlAttributeNode> attributes = XmlAttributeNode.EMPTY_LIST]) { |
+ return new XmlTagNode(ltToken(), stringToken(name), attributes, sgtToken(), |
+ null, null, null, null); |
+ } |
+} |