001 
002 /*
003  *  JScripter Standard 1.0 - To Script In Java
004  *  Copyright (C) 2008-2011  J.J.Liu<jianjunliu@126.com> <http://www.jscripter.org>
005  *  
006  *  This program is free software: you can redistribute it and/or modify
007  *  it under the terms of the GNU Affero General Public License as published by
008  *  the Free Software Foundation, either version 3 of the License, or
009  *  (at your option) any later version.
010  *  
011  *  This program is distributed in the hope that it will be useful,
012  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
013  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
014  *  GNU Affero General Public License for more details.
015  *  
016  *  You should have received a copy of the GNU Affero General Public License
017  *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
018  */
019 
020 package js.user;
021 
022 import js.*;
023 import js.core.*;
024 
025 /**
026  * <p>An <b>opaque</b> class representing JavaScript client-side objects of the global 
027  * {@link JsClient#HTMLDocument} class.</p>
028  *
029  * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
030  *
031  * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be
032  * generated into the target codes. Re-compilers must exit with error on the operations of
033  * accessing that kind of class objects.
034  * The <tt>checkcast</tt> operation to the class literal of this interface must be ignored
035  * and <tt>instanceof</tt> to it always <tt>true</tt>.
036  */
037 public class JsHTMLDocument extends JsClient.HTMLDocument.Prototype
038 {
039     /**
040      * <p>An <b>internal</b> class containing membership data for its enclosing
041      * opaque class.</p>
042      * <p>This class is only used inside of <b>opaque</b> or <b>internal</b> classes or
043      * class members.</p>
044      *
045      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
046      * 
047      * @javascript Re-compilers must report error on resolving an <b>internal</b> class.
048      */
049     protected static abstract class Members extends JsClient.HTMLDocument.Prototype.Members
050     {
051         /**
052          * <p>An <b>internal</b> static field defining a member ID of the field name and
053          * used internally to define a member of the same name.</p>
054          * @since 1.0
055          * @see JsHTMLDocument#all
056          * @see JsHTMLDocument.Member#all
057          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
058          */
059         public final static Mid all          = id("all"         );
060         /**
061          * <p>An <b>internal</b> static field defining a member ID of the field name and
062          * used internally to define a member of the same name.</p>
063          * @since 1.0
064          * @see JsHTMLDocument#anchors
065          * @see JsHTMLDocument.Member#anchors
066          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
067          */
068         public final static Mid anchors      = id("anchors"     );
069         /**
070          * <p>An <b>internal</b> static field defining a member ID of the field name and
071          * used internally to define a member of the same name.</p>
072          * @since 1.0
073          * @see JsHTMLDocument#applets
074          * @see JsHTMLDocument.Member#applets
075          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
076          */
077         public final static Mid applets      = id("applets"     );
078         /**
079          * <p>An <b>internal</b> static field defining a member ID of the field name and
080          * used internally to define a member of the same name.</p>
081          * @since 1.0
082          * @see JsHTMLDocument#body
083          * @see JsHTMLDocument.Member#body
084          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
085          */
086         public final static Mid body         = id("body"        );
087         /**
088          * <p>An <b>internal</b> static field defining a member ID of the field name and
089          * used internally to define a member of the same name.</p>
090          * @since 1.0
091          * @see JsHTMLDocument#cookie
092          * @see JsHTMLDocument.Member#cookie
093          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
094          */
095         public final static Mid cookie       = id("cookie"      );
096         /**
097          * <p>An <b>internal</b> static field defining a member ID of the field name and
098          * used internally to define a member of the same name.</p>
099          * @since 1.0
100          * @see JsHTMLDocument#domain
101          * @see JsHTMLDocument.Member#domain
102          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
103          */
104         public final static Mid domain       = id("domain"      );
105         /**
106          * <p>An <b>internal</b> static field defining a member ID of the field name and
107          * used internally to define a member of the same name.</p>
108          * @since 1.0
109          * @see JsHTMLDocument#forms
110          * @see JsHTMLDocument.Member#forms
111          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
112          */
113         public final static Mid forms        = id("forms"       );
114         /**
115          * <p>An <b>internal</b> static field defining a member ID of the field name and
116          * used internally to define a member of the same name.</p>
117          * @since 1.0
118          * @see JsHTMLDocument#images
119          * @see JsHTMLDocument.Member#images
120          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
121          */
122         public final static Mid images       = id("images"      );
123         /**
124          * <p>An <b>internal</b> static field defining a member ID of the field name and
125          * used internally to define a member of the same name.</p>
126          * @since 1.0
127          * @see JsHTMLDocument#lastModified
128          * @see JsHTMLDocument.Member#lastModified
129          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
130          */
131         public final static Mid lastModified = id("lastModified");
132         /**
133          * <p>An <b>internal</b> static field defining a member ID of the field name and
134          * used internally to define a member of the same name.</p>
135          * @since 1.0
136          * @see JsHTMLDocument#links
137          * @see JsHTMLDocument.Member#links
138          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
139          */
140         public final static Mid links        = id("links"       );
141         /**
142          * <p>An <b>internal</b> static field defining a member ID of the field name and
143          * used internally to define a member of the same name.</p>
144          * @since 1.0
145          * @see JsHTMLDocument#referrer
146          * @see JsHTMLDocument.Member#referrer
147          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
148          */
149         public final static Mid referrer     = id("referrer"    );
150         /**
151          * <p>An <b>internal</b> static field defining a member ID of the field name and
152          * used internally to define a member of the same name.</p>
153          * @since 1.0
154          * @see JsHTMLDocument#title
155          * @see JsHTMLDocument.Member#title
156          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
157          */
158         public final static Mid title        = id("title"       );
159         /**
160          * <p>An <b>internal</b> static field defining a member ID of the field name and
161          * used internally to define a member of the same name.</p>
162          * @since 1.0
163          * @see JsHTMLDocument#URL
164          * @see JsHTMLDocument.Member#URL
165          * @javascript Re-compilers must report error on accessing an <b>internal</b> field.
166          */
167         public final static Mid URL          = id("URL"         );
168     }
169 
170     /**
171      * <p>An <b>opaque</b> class representing members of its enclosing <b>opaque</b> type.</p>
172      * <p>Note that, this class is <b>opaque</b> but its constructors are all <b>internal</b>. 
173      * This class and the subclasses of this class are used to declare either <b>opaque</b> 
174      * <tt>public</tt> instance fields of the opaque type {@link js.Var.Member} or the 
175      * <b>opaque</b> <tt>public</tt> static fields of other <b>opaque</b> types while their 
176      * constructors are used to define the fields inside <b>opaque</b> classes. Under 
177      * either circumstance, the field names must be exactly same as the member names, as 
178      * the <b>opaque</b> fields of <b>opaque</b> types are resolved by re-compilers directly 
179      * based on the field names.</p>
180      *
181      * @author <a href="mailto:jianjunliu@126.com">J.J.Liu (Jianjun Liu)</a> at <a href="http://www.jscripter.org" target="_blank">http://www.jscripter.org</a>
182      * 
183      * @javascript <b>Opaque</b> types can be resolved but no class objects for them can be created
184      * in the target codes. Re-compilers must exit with error on operations accessing that kind 
185      * of class objects.
186      * Re-compilers must resolve an <b>opaque</b> instance field declared by this class in
187      * {@link js.Var.Member} or its subclasses to the JavaScript identifier: 
188      * <pre>q.m</pre>
189      * where <tt>m</tt> is the identifier of the field name and <tt>q</tt> is the identifier
190      * resolved from the instance of the enclosing member. Re-compilers must resolve an 
191      * <b>opaque</b> static field declared by this class in <b>opaque</b> types other than 
192      * {@link js.Var.Member} and its subclasses to the JavaScript identifier: 
193      * <pre>m</pre>
194      * where <tt>m</tt> is the identifier of the field name. And re-compilers must report
195      * error on the access to <b>opaque</b> fields declared by this class under any other 
196      * circumstances.
197      */
198     public static class Member extends JsClient.HTMLDocument.Prototype.Member
199     {
200         /**
201          * <p>Internally constructs a member based on a qualifying member.</p>
202          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
203          * or <b>internal</b> classes or class members.</p>
204          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
205          * <b>opaque</b>. This constructor is used to define <b>opaque</b> instance fields 
206          * declared in the declaring class of this constructor itself or its subclasses. 
207          * Under this circumstance, the field names must be exactly same as the member 
208          * names, as the <b>opaque</b> instance fields of the <b>opaque</b> type 
209          * {@link js.Var.Member} or its subclasses are resolved by re-compilers directly
210          * to their names appending to the name resolved from the specified qualifying 
211          * member with a dot in between.</p>
212          * @param q A qualifying member
213          * @param mid The ID of the member to construct
214          * @since 1.0
215          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
216          */
217         public Member(JsObject.Member q, Mid mid) {
218             super(q, mid);
219         }
220         /**
221          * <p>Internally constructs a member without a qualifying member.</p>
222          * <p>This constructor is <b>internal</b> and only called inside of <b>opaque</b>
223          * or <b>internal</b> classes or class members.</p>
224          * <p>Note that, this constructor is <b>internal</b> but its declaring class is
225          * <b>opaque</b>. This constructor is used to define <b>opaque</b> static fields, 
226          * declared in <b>opaque</b> types other than the declaring class of this constructor 
227          * itself and its subclasses. Under this circumstance, the field names must be
228          * exactly same as the member names, as the <b>opaque</b> static fields of <b>opaque</b>
229          * types are generally resolved by re-compilers directly to identifiers of their names.</p>
230          * @param mid The ID of the member to construct
231          * @since 1.0
232          * @javascript Re-compilers must report error on the invocation to an <b>internal</b> constructor.
233          */
234         public Member(Mid mid) {
235             super(mid);
236         }
237         @Override
238         /**
239          * <p>Evaluates the property, represented by the current member instance, of the
240          * argument object.</p>
241          * @param o The argument object
242          * @return The value of the current member based on the object argument.
243          * @since 1.0
244          * @javascript Re-compilers must convert the instance invocation of this method into
245          * the JavaScript expression: 
246          * <pre>o.m</pre>
247          * where <tt>m</tt> is the identifier name resolved from the current member
248          * instance of the invocation.
249          */
250         public JsHTMLDocument with(ObjectLike o) {
251             return new JsHTMLDocument(super.with(o));
252         }
253         @Override
254         /**
255          * <p>Evaluates a property, represented by the current member instance, of the
256          * JavaScript global object, that is, evaluates the member to a global identifier.</p>
257          * @return The value of the current member based on the JavaScript global object.
258          * @since 1.0
259          * @javascript Re-compilers must convert the instance invocation of this method into
260          * the JavaScript expression: 
261          * <pre>m</pre>
262          * where <tt>m</tt> is the identifier name resolved from the current member
263          * instance of the invocation.
264          */
265         public JsHTMLDocument with() {
266             return with(Js.win());
267         }
268 
269         /**
270          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
271          * name of this field, qualified by the current member instance of the field, and 
272          * to access the property of the name on an object.</p>
273          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
274          * refers to a string allowing cookies to be queried and set for the document.</p>
275          * @since 1.0
276          * @javascript Re-compilers must resolve the member of this instance field to the
277          * identifier of the field name appending to the identifier resolved from its 
278          * qualifying member with a dot in between.
279          */
280         public final Value.String.Member cookie       = new Value.String.Member(this, Members.cookie      );
281         /**
282          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
283          * name of this field, qualified by the current member instance of the field, and 
284          * to access the property of the name on an object.</p>
285          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
286          * refers to the domain name of the server from which the document was loaded, 
287          * or <tt>null</tt> if there is none. This property can also be used to ease the 
288          * same-origin security policy in specific circumstances.</p>
289          * @since 1.0
290          * @javascript Re-compilers must resolve the member of this instance field to the
291          * identifier of the field name appending to the identifier resolved from its 
292          * qualifying member with a dot in between.
293          */
294         public final Value.String.Member domain       = new Value.String.Member(this, Members.domain      );
295         /**
296          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
297          * name of this field, qualified by the current member instance of the field, and 
298          * to access the property of the name on an object.</p>
299          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
300          * refers to a read-only string specifying the date and time of the most recent 
301          * modification to the document. This value comes from the Last-Modified HTTP 
302          * header that is optionally sent by the web server.</p> 
303          * @since 1.0
304          * @javascript Re-compilers must resolve the member of this instance field to the
305          * identifier of the field name appending to the identifier resolved from its 
306          * qualifying member with a dot in between.
307          */
308         public final Value.String.Member lastModified = new Value.String.Member(this, Members.lastModified);
309         /**
310          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
311          * name of this field, qualified by the current member instance of the field, and 
312          * to access the property of the name on an object.</p>
313          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
314          * refers to a read-only string specifying the URL of the document that linked 
315          * to this document, or <tt>null</tt> if this document was not accessed through 
316          * a hyper-link. This property allows the client-side access to the HTTP <tt>referer</tt> 
317          * header. Note the spelling difference, however: the HTTP header has three r's, 
318          * and the property has four r's.</p> 
319          * @since 1.0
320          * @javascript Re-compilers must resolve the member of this instance field to the
321          * identifier of the field name appending to the identifier resolved from its 
322          * qualifying member with a dot in between.
323          */
324         public final Value.String.Member referrer     = new Value.String.Member(this, Members.referrer    );
325         /**
326          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
327          * name of this field, qualified by the current member instance of the field, and 
328          * to access the property of the name on an object.</p>
329          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
330          * refers to the contents of the <tt>&lt;title&gt;</tt> tag for this document.</p> 
331          * @since 1.0
332          * @javascript Re-compilers must resolve the member of this instance field to the
333          * identifier of the field name appending to the identifier resolved from its 
334          * qualifying member with a dot in between.
335          */
336         public final Value.String.Member title        = new Value.String.Member(this, Members.title       );
337         /**
338          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
339          * name of this field, qualified by the current member instance of the field, and 
340          * to access the property of the name on an object.</p>
341          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
342          * refers to a read-only string specifying the URL of the document. This value 
343          * is often the same as the {@link JsLocation#href} property of the {@link JsWindow} 
344          * object that contains the document. When URL redirection occurs, however, this 
345          * property holds the actual URL of the document, and {@link JsLocation#href} 
346          * holds the URL that was requested.</p> 
347          * @since 1.0
348          * @javascript Re-compilers must resolve the member of this instance field to the
349          * identifier of the field name appending to the identifier resolved from its 
350          * qualifying member with a dot in between.
351          */
352         public final Value.String.Member URL          = new Value.String.Member(this, Members.URL         );
353         /**
354          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
355          * name of this field, qualified by the current member instance of the field, and 
356          * to access the property of the name on an object.</p>
357          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
358          * refers to an array-like object that provides access to all {@link JsHTMLElement} 
359          * object in the document. The nonstandard property originated in IE4. Although 
360          * it has been superseded by methods such as {@link JsDocument#getElementById(String)} 
361          * and {@link JsDocument#getElementsByTagName(String)}, it is still used in 
362          * deployed JavaScript code.</p> 
363          * @since 1.0
364          * @javascript Re-compilers must resolve the member of this instance field to the
365          * identifier of the field name appending to the identifier resolved from its 
366          * qualifying member with a dot in between.
367          */
368         public final JsNodeList.Member<JsElement> all = new JsNodeList.Member<JsElement>(this, Members.all);
369         /**
370          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
371          * name of this field, qualified by the current member instance of the field, and 
372          * to access the property of the name on an object.</p>
373          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
374          * is a read-only reference to an array of all {@link JsHTMLAnchorElement} objects 
375          * in the document.</p> 
376          * @since 1.0
377          * @javascript Re-compilers must resolve the member of this instance field to the
378          * identifier of the field name appending to the identifier resolved from its 
379          * qualifying member with a dot in between.
380          */
381         public final JsHTMLCollection.Member<JsHTMLAnchorElement> anchors = new JsHTMLCollection.Member<JsHTMLAnchorElement>(this, Members.anchors);
382         /**
383          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
384          * name of this field, qualified by the current member instance of the field, and 
385          * to access the property of the name on an object.</p>
386          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
387          * is a read-only reference to an array of all {@link JsHTMLAppletElement} objects 
388          * in the document.</p> 
389          * @since 1.0
390          * @javascript Re-compilers must resolve the member of this instance field to the
391          * identifier of the field name appending to the identifier resolved from its 
392          * qualifying member with a dot in between.
393          */
394         public final JsHTMLCollection.Member<JsHTMLAppletElement> applets = new JsHTMLCollection.Member<JsHTMLAppletElement>(this, Members.applets     );
395         /**
396          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
397          * name of this field, qualified by the current member instance of the field, and 
398          * to access the property of the name on an object.</p>
399          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
400          * refers to the {@link JsHTMLElement} that represents the <tt>&lt;body&gt;</tt> 
401          * tag of this document. For documents that define frame sets, this property 
402          * refers to the outermost <tt>&lt;frameset&gt;</tt> tag instead.</p> 
403          * @since 1.0
404          * @javascript Re-compilers must resolve the member of this instance field to the
405          * identifier of the field name appending to the identifier resolved from its 
406          * qualifying member with a dot in between.
407          */
408         public final JsHTMLElement.Member body = new JsHTMLElement.Member(this, Members.body);
409         /**
410          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
411          * name of this field, qualified by the current member instance of the field, and 
412          * to access the property of the name on an object.</p>
413          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
414          * is a read-only reference to an array of all {@link JsHTMLFormElement} objects 
415          * in the document.</p> 
416          * @since 1.0
417          * @javascript Re-compilers must resolve the member of this instance field to the
418          * identifier of the field name appending to the identifier resolved from its 
419          * qualifying member with a dot in between.
420          */
421         public final JsHTMLCollection.Member<JsHTMLFormElement> forms = new JsHTMLCollection.Member<JsHTMLFormElement>(this, Members.forms);
422         /**
423          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
424          * name of this field, qualified by the current member instance of the field, and 
425          * to access the property of the name on an object.</p>
426          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
427          * is a read-only reference to an array of all {@link JsHTMLImageElement} objects 
428          * in the document. For compatibility with the Level 0 DOM, images defined with 
429          * an <tt>&lt;object&gt;</tt> tag instead of the <tt>&lt;img&gt;</tt> tag are 
430          * not included in this collection.</p> 
431          * @since 1.0
432          * @javascript Re-compilers must resolve the member of this instance field to the
433          * identifier of the field name appending to the identifier resolved from its 
434          * qualifying member with a dot in between.
435          */
436         public final JsHTMLCollection.Member<JsHTMLImageElement> images = new JsHTMLCollection.Member<JsHTMLImageElement>(this, Members.images);
437         /**
438          * <p>An <b>opaque</b> instance field defining a sub-member that is named by the
439          * name of this field, qualified by the current member instance of the field, and 
440          * to access the property of the name on an object.</p>
441          * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
442          * is a read-only reference to an array of all {@link JsHTMLLinkElement} objects 
443          * in the document.</p> 
444          * @since 1.0
445          * @javascript Re-compilers must resolve the member of this instance field to the
446          * identifier of the field name appending to the identifier resolved from its 
447          * qualifying member with a dot in between.
448          */
449         public final JsHTMLCollection.Member<JsHTMLLinkElement> links = new JsHTMLCollection.Member<JsHTMLLinkElement>(this, Members.links);
450     }
451 
452     /**
453      * <p>Casts an <b>opaque</b> object to the current <b>opaque</b> type by wrapping it
454      * with the wrapping constructor.</p>
455      * @param var The argument of an <b>opaque</b> object.
456      * @since 1.0
457      * @javascript Re-compilers must ignore the construction operation of this constructor,
458      * that is, replacing it with its only argument.
459      */
460     public JsHTMLDocument(JsObject var) {
461         super(var);
462     }
463 
464     /**
465      * <p>An <b>opaque</b> static field defining a member that is named by the field name
466      * without a qualifying member and to access the property of the name on an object.</p>
467      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
468      * refers to a string allowing cookies to be queried and set for the document.</p>
469      * @since 1.0
470      * @javascript Re-compilers must resolve the member of this static field to the
471      * identifier of the field name.
472      */
473     public static final Value.String.Member cookie       = new Value.String.Member(Members.cookie      );
474     /**
475      * <p>An <b>opaque</b> static field defining a member that is named by the field name
476      * without a qualifying member and to access the property of the name on an object.</p>
477      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
478      * refers to the domain name of the server from which the document was loaded, 
479      * or <tt>null</tt> if there is none. This property can also be used to ease the 
480      * same-origin security policy in specific circumstances.</p>
481      * @since 1.0
482      * @javascript Re-compilers must resolve the member of this static field to the
483      * identifier of the field name.
484      */
485     public static final Value.String.Member domain       = new Value.String.Member(Members.domain      );
486     /**
487      * <p>An <b>opaque</b> static field defining a member that is named by the field name
488      * without a qualifying member and to access the property of the name on an object.</p>
489      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
490      * refers to a read-only string specifying the date and time of the most recent 
491      * modification to the document. This value comes from the Last-Modified HTTP 
492      * header that is optionally sent by the web server.</p> 
493      * @since 1.0
494      * @javascript Re-compilers must resolve the member of this static field to the
495      * identifier of the field name.
496      */
497     public static final Value.String.Member lastModified = new Value.String.Member(Members.lastModified);
498     /**
499      * <p>An <b>opaque</b> static field defining a member that is named by the field name
500      * without a qualifying member and to access the property of the name on an object.</p>
501      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
502      * refers to a read-only string specifying the URL of the document that linked 
503      * to this document, or <tt>null</tt> if this document was not accessed through 
504      * a hyper-link. This property allows the client-side access to the HTTP <tt>referer</tt> 
505      * header. Note the spelling difference, however: the HTTP header has three r's, 
506      * and the property has four r's.</p> 
507      * @since 1.0
508      * @javascript Re-compilers must resolve the member of this static field to the
509      * identifier of the field name.
510      */
511     public static final Value.String.Member referrer     = new Value.String.Member(Members.referrer    );
512     /**
513      * <p>An <b>opaque</b> static field defining a member that is named by the field name
514      * without a qualifying member and to access the property of the name on an object.</p>
515      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
516      * refers to the contents of the <tt>&lt;title&gt;</tt> tag for this document.</p> 
517      * @since 1.0
518      * @javascript Re-compilers must resolve the member of this static field to the
519      * identifier of the field name.
520      */
521     public static final Value.String.Member title        = new Value.String.Member(Members.title       );
522     /**
523      * <p>An <b>opaque</b> static field defining a member that is named by the field name
524      * without a qualifying member and to access the property of the name on an object.</p>
525      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
526      * refers to a read-only string specifying the URL of the document. This value 
527      * is often the same as the {@link JsLocation#href} property of the {@link JsWindow} 
528      * object that contains the document. When URL redirection occurs, however, this 
529      * property holds the actual URL of the document, and {@link JsLocation#href} 
530      * holds the URL that was requested.</p> 
531      * @since 1.0
532      * @javascript Re-compilers must resolve the member of this static field to the
533      * identifier of the field name.
534      */
535     public static final Value.String.Member URL          = new Value.String.Member(Members.URL         );
536     /**
537      * <p>An <b>opaque</b> static field defining a member that is named by the field name
538      * without a qualifying member and to access the property of the name on an object.</p>
539      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
540      * refers to an array-like object that provides access to all {@link JsHTMLElement} 
541      * object in the document. The nonstandard property originated in IE4. Although 
542      * it has been superseded by methods such as {@link JsDocument#getElementById(String)} 
543      * and {@link JsDocument#getElementsByTagName(String)}, it is still used in 
544      * deployed JavaScript code.</p> 
545      * @since 1.0
546      * @javascript Re-compilers must resolve the member of this static field to the
547      * identifier of the field name.
548      */
549     public static final JsNodeList.Member<JsElement> all = new JsNodeList.Member<JsElement>(Members.all);
550     /**
551      * <p>An <b>opaque</b> static field defining a member that is named by the field name
552      * without a qualifying member and to access the property of the name on an object.</p>
553      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
554      * is a read-only reference to an array of all {@link JsHTMLAnchorElement} objects 
555      * in the document.</p> 
556      * @since 1.0
557      * @javascript Re-compilers must resolve the member of this static field to the
558      * identifier of the field name.
559      */
560     public static final JsHTMLCollection.Member<JsHTMLAnchorElement> anchors = new JsHTMLCollection.Member<JsHTMLAnchorElement>(Members.anchors);
561     /**
562      * <p>An <b>opaque</b> static field defining a member that is named by the field name
563      * without a qualifying member and to access the property of the name on an object.</p>
564      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
565      * is a read-only reference to an array of all {@link JsHTMLAppletElement} objects 
566      * in the document.</p> 
567      * @since 1.0
568      * @javascript Re-compilers must resolve the member of this static field to the
569      * identifier of the field name.
570      */
571     public static final JsHTMLCollection.Member<JsHTMLAppletElement> applets = new JsHTMLCollection.Member<JsHTMLAppletElement>(Members.applets     );
572     /**
573      * <p>An <b>opaque</b> static field defining a member that is named by the field name
574      * without a qualifying member and to access the property of the name on an object.</p>
575      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
576      * refers to the {@link JsHTMLElement} that represents the <tt>&lt;body&gt;</tt> 
577      * tag of this document. For documents that define frame sets, this property 
578      * refers to the outermost <tt>&lt;frameset&gt;</tt> tag instead.</p> 
579      * @since 1.0
580      * @javascript Re-compilers must resolve the member of this static field to the
581      * identifier of the field name.
582      */
583     public static final JsHTMLElement.Member body = new JsHTMLElement.Member(Members.body);
584     /**
585      * <p>An <b>opaque</b> static field defining a member that is named by the field name
586      * without a qualifying member and to access the property of the name on an object.</p>
587      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
588      * is a read-only reference to an array of all {@link JsHTMLFormElement} objects 
589      * in the document.</p> 
590      * @since 1.0
591      * @javascript Re-compilers must resolve the member of this static field to the
592      * identifier of the field name.
593      */
594     public static final JsHTMLCollection.Member<JsHTMLFormElement> forms = new JsHTMLCollection.Member<JsHTMLFormElement>(Members.forms);
595     /**
596      * <p>An <b>opaque</b> static field defining a member that is named by the field name
597      * without a qualifying member and to access the property of the name on an object.</p>
598      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
599      * is a read-only reference to an array of all {@link JsHTMLImageElement} objects 
600      * in the document. For compatibility with the Level 0 DOM, images defined with 
601      * an <tt>&lt;object&gt;</tt> tag instead of the <tt>&lt;img&gt;</tt> tag are 
602      * not included in this collection.</p> 
603      * @since 1.0
604      * @javascript Re-compilers must resolve the member of this static field to the
605      * identifier of the field name.
606      */
607     public static final JsHTMLCollection.Member<JsHTMLImageElement> images = new JsHTMLCollection.Member<JsHTMLImageElement>(Members.images);
608     /**
609      * <p>An <b>opaque</b> static field defining a member that is named by the field name
610      * without a qualifying member and to access the property of the name on an object.</p>
611      * <p>The property, identified by this member, of a {@link JsHTMLDocument} object 
612      * is a read-only reference to an array of all {@link JsHTMLLinkElement} objects 
613      * in the document.</p> 
614      * @since 1.0
615      * @javascript Re-compilers must resolve the member of this static field to the
616      * identifier of the field name.
617      */
618     public static final JsHTMLCollection.Member<JsHTMLLinkElement> links = new JsHTMLCollection.Member<JsHTMLLinkElement>(Members.links);
619 
620     @Override
621     /**
622      * <p>Returns the primitive value associated with the current instance, if there is one.
623      * This invocation simply returns the instance itself for the current instance is an 
624      * object and there is no primitive value for it.</p>
625      * @return The current object itself.
626      * @since 1.0
627      * @javascript Re-compilers must convert the instance invocation of this method directly
628      * into a JavaScript invocation on its current object instance without changing the 
629      * method name, but expanding variable arguments, if any, into comma-separated values. 
630      */
631     public JsHTMLDocument valueOf() {
632         return new JsHTMLDocument((JsObject)var().valueOf());
633     }
634     public final JsHTMLCollection<?> var(JsHTMLCollection.Member<?> r) {
635         return r.with(this);
636     }
637 
638     /**
639      * <p>Closes a document stream opened with the {@link #open()} method, forcing any 
640      * buffered output to be displayed.</p>
641      * <p>This method closes a document stream that was opened with the {@link #open()} 
642      * method and forces any buffered output to be displayed. If you use the {@link #write(String)} 
643      * or {@link #writeln(String)} methods to dynamically output a document, you must 
644      * remember to call this method when it is done to ensure that all your document 
645      * content is displayed. Once you have called this method, you should not call {@link #write(String)} 
646      * or {@link #writeln(String)} again, as this implicitly calls {@link #open()} to 
647      * erase the current document and begin a new one.</p>
648      * @since 1.0
649      * @see #open()
650      * @see #write(String)
651      * @see #writeln(String)
652      * @javascript Re-compilers must convert the instance invocation of this method directly
653      * into a JavaScript invocation on its current object instance without changing the 
654      * method name, but expanding variable arguments, if any, into comma-separated values. 
655      */
656     public final void close() {
657         call(close);
658     }
659     /**
660      * <p>Returns an array of nodes of all elements in the document that have a 
661      * specified value for their <tt>name</tt> attribute.</p>
662      * @param name .
663      * @return The current object itself.
664      * @since 1.0
665      * @javascript Re-compilers must convert the instance invocation of this method directly
666      * into a JavaScript invocation on its current object instance without changing the 
667      * method name, but expanding variable arguments, if any, into comma-separated values. 
668      */
669     public final JsNodeList<? extends JsHTMLElement> getElementsByName(String name) {
670         return new JsNodeList<JsHTMLElement>(call(getElementsByName, name));
671     }
672     public final JsNodeList<? extends JsHTMLElement> getElementsByName(StringLike name) {
673         return new JsNodeList<JsHTMLElement>(call(getElementsByName, name));
674     }
675     /**
676      * <p>Opens a stream to which new document contents may be written, erasing any 
677      * current document content.</p>
678      * <p>This method erases the current HTML document and begins a new one, which may 
679      * be written to with the {@link #write(String)} and {@link #writeln(String)} methods. 
680      * After calling this method to begin a new document and {@link #write(String)} or 
681      * {@link #writeln(String)} to specify document content, you must always remember to 
682      * call {@link #close()} to end the document and force its content to be displayed.</p>
683      * <p>This method should not be called by a script or event handler that is part of 
684      * the document being overwritten, because the script or handler will itself be 
685      * overwritten.</p>
686      * @since 1.0
687      * @see #close()
688      * @see #write(String)
689      * @see #writeln(String)
690      * @javascript Re-compilers must convert the instance invocation of this method directly
691      * into a JavaScript invocation on its current object instance without changing the 
692      * method name, but expanding variable arguments, if any, into comma-separated values. 
693      */
694     public final void open() {
695         call(open);
696     }
697     /**
698      * <p>Appends a string of HTML text to an open document.</p>
699      * <p>This method appends the specified HTML text to the document. According to the 
700      * DOM standard, this method takes a single string argument. According to common 
701      * practice, however, it may be passed any number of arguments. These arguments are 
702      * converted to strings and appended, in order, to the document.</p>
703      * <p>The method is normally used in one of two ways. First, it can be invoked on 
704      * the current document within a <tt>&lt;script&gt;</tt> tag or within a function 
705      * that is executed while the document is being parsed. In this case, this method 
706      * writes its HTML output as if that output appeared literally in the file at the 
707      * location of the code that invoked the method.</p>
708      * <p>Second, you can use this method to dynamically generate new documents in a 
709      * window, frame, or iframe other than the one in which the calling script is running. 
710      * If the target document is open, this method appends to that document. If the 
711      * document is not open, the method discards the existing document and opens a new 
712      * empty one to which it appends its arguments.</p>
713      * <p>Once a document is open, this method can append any amount of output to the 
714      * end of the document. When a new document has been completely generated by this 
715      * technique, the document must be closed by calling {@link #close()}. Note that 
716      * although the call to {@link #open()} is optional, the call to {@link #close()} is 
717      * never optional.</p>
718      * <p>The results of calling this method may not be immediately visible in the 
719      * target document. This is because a web browser may buffer up text to parse and 
720      * display in larger chunks. Calling {@link #close()} is the only way to explicitly 
721      * force all buffered output to be "flushed" and displayed.</p>
722      * @param text The HTML text to be appended to the document.
723      * @since 1.0
724      * @see #write(StringLike)
725      * @see #write(Vars)
726      * @see #writeln(String)
727      * @see #close()
728      * @see #open()
729      * @javascript Re-compilers must convert the instance invocation of this method directly
730      * into a JavaScript invocation on its current object instance without changing the 
731      * method name, but expanding variable arguments, if any, into comma-separated values. 
732      */
733     public final void write(String text) {
734         call(write, text);
735     }
736     /**
737      * <p>Appends a string of HTML text to an open document.</p>
738      * <p>This method appends the specified HTML text to the document. According to the 
739      * DOM standard, this method takes a single string argument. According to common 
740      * practice, however, it may be passed any number of arguments. These arguments are 
741      * converted to strings and appended, in order, to the document.</p>
742      * <p>The method is normally used in one of two ways. First, it can be invoked on 
743      * the current document within a <tt>&lt;script&gt;</tt> tag or within a function 
744      * that is executed while the document is being parsed. In this case, this method 
745      * writes its HTML output as if that output appeared literally in the file at the 
746      * location of the code that invoked the method.</p>
747      * <p>Second, you can use this method to dynamically generate new documents in a 
748      * window, frame, or iframe other than the one in which the calling script is running. 
749      * If the target document is open, this method appends to that document. If the 
750      * document is not open, the method discards the existing document and opens a new 
751      * empty one to which it appends its arguments.</p>
752      * <p>Once a document is open, this method can append any amount of output to the 
753      * end of the document. When a new document has been completely generated by this 
754      * technique, the document must be closed by calling {@link #close()}. Note that 
755      * although the call to {@link #open()} is optional, the call to {@link #close()} is 
756      * never optional.</p>
757      * <p>The results of calling this method may not be immediately visible in the 
758      * target document. This is because a web browser may buffer up text to parse and 
759      * display in larger chunks. Calling {@link #close()} is the only way to explicitly 
760      * force all buffered output to be "flushed" and displayed.</p>
761      * @param args The arguments to be converted to strings and appended, in order, 
762      * to the document.
763      * @since 1.0
764      * @see #write(String)
765      * @see #write(StringLike)
766      * @see #writeln(String)
767      * @see #close()
768      * @see #open()
769      * @javascript Re-compilers must convert the instance invocation of this method directly
770      * into a JavaScript invocation on its current object instance without changing the 
771      * method name, but expanding variable arguments, if any, into comma-separated values. 
772      */
773     public final void write(Vars<String> args) {
774         call(write, args);
775     }
776     /**
777      * <p>Appends a string of HTML text to an open document.</p>
778      * <p>This method appends the specified HTML text to the document. According to the 
779      * DOM standard, this method takes a single string argument. According to common 
780      * practice, however, it may be passed any number of arguments. These arguments are 
781      * converted to strings and appended, in order, to the document.</p>
782      * <p>The method is normally used in one of two ways. First, it can be invoked on 
783      * the current document within a <tt>&lt;script&gt;</tt> tag or within a function 
784      * that is executed while the document is being parsed. In this case, this method 
785      * writes its HTML output as if that output appeared literally in the file at the 
786      * location of the code that invoked the method.</p>
787      * <p>Second, you can use this method to dynamically generate new documents in a 
788      * window, frame, or iframe other than the one in which the calling script is running. 
789      * If the target document is open, this method appends to that document. If the 
790      * document is not open, the method discards the existing document and opens a new 
791      * empty one to which it appends its arguments.</p>
792      * <p>Once a document is open, this method can append any amount of output to the 
793      * end of the document. When a new document has been completely generated by this 
794      * technique, the document must be closed by calling {@link #close()}. Note that 
795      * although the call to {@link #open()} is optional, the call to {@link #close()} is 
796      * never optional.</p>
797      * <p>The results of calling this method may not be immediately visible in the 
798      * target document. This is because a web browser may buffer up text to parse and 
799      * display in larger chunks. Calling {@link #close()} is the only way to explicitly 
800      * force all buffered output to be "flushed" and displayed.</p>
801      * @param text The HTML text to be appended to the document.
802      * @since 1.0
803      * @see #write(String)
804      * @see #write(Vars)
805      * @see #writeln(StringLike)
806      * @see #close()
807      * @see #open()
808      * @javascript Re-compilers must convert the instance invocation of this method directly
809      * into a JavaScript invocation on its current object instance without changing the 
810      * method name, but expanding variable arguments, if any, into comma-separated values. 
811      */
812     public final void write(StringLike text) {
813         write(Js.valueOf(text));
814     }
815     /**
816      * <p>Appends a string of HTML text followed by a newline character to an open document.</p>
817      * <p>This method is like {@link #write(String)}, except that it follows the 
818      * appended text with a newline character, which may be useful when writing the 
819      * content of a <tt>&lt;pre&gt;</tt> tag, for example.</p>
820      * @param text The HTML text to be appended to the document.
821      * @since 1.0
822      * @see #writeln(StringLike)
823      * @see #write(String)
824      * @see #close()
825      * @see #open()
826      * @javascript Re-compilers must convert the instance invocation of this method directly
827      * into a JavaScript invocation on its current object instance without changing the 
828      * method name, but expanding variable arguments, if any, into comma-separated values. 
829      */
830     public final void writeln(String text) {
831         call(writeln, text);
832     }
833     /**
834      * <p>Appends a string of HTML text followed by a newline character to an open document.</p>
835      * <p>This method is like {@link #write(StringLike)}, except that it follows the 
836      * appended text with a newline character, which may be useful when writing the 
837      * content of a <tt>&lt;pre&gt;</tt> tag, for example.</p>
838      * @param text The HTML text to be appended to the document.
839      * @since 1.0
840      * @see #writeln(String)
841      * @see #write(StringLike)
842      * @see #close()
843      * @see #open()
844      * @javascript Re-compilers must convert the instance invocation of this method directly
845      * into a JavaScript invocation on its current object instance without changing the 
846      * method name, but expanding variable arguments, if any, into comma-separated values. 
847      */
848     public final void writeln(StringLike text) {
849         writeln(Js.valueOf(text));
850     }
851 }