View Javadoc
1   /*
2    * Copyright (c) 2002-2026 Gargoyle Software Inc.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * https://www.apache.org/licenses/LICENSE-2.0
8    *
9    * Unless required by applicable law or agreed to in writing, software
10   * distributed under the License is distributed on an "AS IS" BASIS,
11   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12   * See the License for the specific language governing permissions and
13   * limitations under the License.
14   */
15  package org.htmlunit.javascript.host.html;
16  
17  import org.htmlunit.html.DomElement;
18  import org.htmlunit.html.HtmlMeta;
19  import org.htmlunit.javascript.configuration.JsxClass;
20  import org.htmlunit.javascript.configuration.JsxConstructor;
21  import org.htmlunit.javascript.configuration.JsxGetter;
22  import org.htmlunit.javascript.configuration.JsxSetter;
23  
24  /**
25   * The JavaScript object {@code HTMLMetaElement}.
26   *
27   * @author Ahmed Ashour
28   * @author Ronald Brill
29   *
30   * @see <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLMetaElement">MDN Documentation</a>
31   */
32  @JsxClass(domClass = HtmlMeta.class)
33  public class HTMLMetaElement extends HTMLElement {
34  
35      /**
36       * JavaScript constructor.
37       */
38      @Override
39      @JsxConstructor
40      public void jsConstructor() {
41          super.jsConstructor();
42      }
43  
44      /**
45       * Returns the {@code content} attribute.
46       * @return the {@code content} attribute
47       */
48      @JsxGetter
49      public String getContent() {
50          return getDomNodeOrDie().getAttributeDirect("content");
51      }
52  
53      /**
54       * Sets the {@code content} attribute.
55       * @param content the {@code content} attribute value
56       */
57      @JsxSetter
58      public void setContent(final String content) {
59          getDomNodeOrDie().setAttribute("content", content);
60      }
61  
62      /**
63       * Returns the {@code http-equiv} attribute.
64       * @return the {@code http-equiv} attribute
65       */
66      @JsxGetter
67      public String getHttpEquiv() {
68          return getDomNodeOrDie().getAttribute("http-equiv");
69      }
70  
71      /**
72       * Sets the {@code http-equiv} attribute.
73       * @param httpEquiv the {@code http-equiv} attribute value
74       */
75      @JsxSetter
76      public void setHttpEquiv(final String httpEquiv) {
77          getDomNodeOrDie().setAttribute("http-equiv", httpEquiv);
78      }
79  
80      /**
81       * Returns the {@code name} attribute.
82       * @return the {@code name} attribute
83       */
84      @JsxGetter
85      @Override
86      public String getName() {
87          return getDomNodeOrDie().getAttributeDirect(DomElement.NAME_ATTRIBUTE);
88      }
89  
90      /**
91       * Sets the {@code name} attribute.
92       * @param name the {@code name} attribute value
93       */
94      @JsxSetter
95      @Override
96      public void setName(final String name) {
97          getDomNodeOrDie().setAttribute(DomElement.NAME_ATTRIBUTE, name);
98      }
99  
100     /**
101      * Returns the {@code scheme} attribute.
102      * @return the {@code scheme} attribute
103      */
104     @JsxGetter
105     public String getScheme() {
106         return getDomNodeOrDie().getAttributeDirect("scheme");
107     }
108 
109     /**
110      * Sets the {@code scheme} attribute.
111      * @param scheme the {@code scheme} attribute value
112      */
113     @JsxSetter
114     public void setScheme(final String scheme) {
115         getDomNodeOrDie().setAttribute("scheme", scheme);
116     }
117 
118     /**
119      * Returns the {@code media} attribute.
120      * @return the {@code media} attribute
121      */
122     @JsxGetter
123     public String getMedia() {
124         return getDomNodeOrDie().getAttribute("media");
125     }
126 
127     /**
128      * Sets the {@code media} attribute.
129      * @param media the {@code media} attribute value
130      */
131     @JsxSetter
132     public void setMedia(final String media) {
133         getDomNodeOrDie().setAttribute("media", media);
134     }
135 
136     /**
137      * {@inheritDoc}
138      */
139     @Override
140     protected boolean isEndTagForbidden() {
141         return true;
142     }
143 }