1 /*
2 * Copyright (c) 2002-2025 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 @JsxClass(domClass = HtmlMeta.class)
31 public class HTMLMetaElement extends HTMLElement {
32
33 /**
34 * JavaScript constructor.
35 */
36 @Override
37 @JsxConstructor
38 public void jsConstructor() {
39 super.jsConstructor();
40 }
41
42 /**
43 * Returns the {@code content} attribute.
44 * @return the {@code content} attribute
45 */
46 @JsxGetter
47 public String getContent() {
48 return getDomNodeOrDie().getAttributeDirect("content");
49 }
50
51 /**
52 * Sets the {@code content} attribute.
53 * @param content the content attribute
54 */
55 @JsxSetter
56 public void setContent(final String content) {
57 getDomNodeOrDie().setAttribute("content", content);
58 }
59
60 /**
61 * Returns the {@code http-equiv} attribute.
62 * @return the {@code http-equiv} attribute
63 */
64 @JsxGetter
65 public String getHttpEquiv() {
66 return getDomNodeOrDie().getAttribute("http-equiv");
67 }
68
69 /**
70 * Sets the {@code http-equiv} attribute.
71 * @param httpEquiv the http-equiv attribute
72 */
73 @JsxSetter
74 public void setHttpEquiv(final String httpEquiv) {
75 getDomNodeOrDie().setAttribute("http-equiv", httpEquiv);
76 }
77
78 /**
79 * Returns the {@code name} attribute.
80 * @return the {@code name} attribute
81 */
82 @JsxGetter
83 @Override
84 public String getName() {
85 return getDomNodeOrDie().getAttributeDirect(DomElement.NAME_ATTRIBUTE);
86 }
87
88 /**
89 * Sets the {@code name} attribute.
90 * @param name the {@code name} attribute
91 */
92 @JsxSetter
93 @Override
94 public void setName(final String name) {
95 getDomNodeOrDie().setAttribute(DomElement.NAME_ATTRIBUTE, name);
96 }
97
98 /**
99 * Returns the {@code scheme} attribute.
100 * @return the {@code scheme} attribute
101 */
102 @JsxGetter
103 public String getScheme() {
104 return getDomNodeOrDie().getAttributeDirect("scheme");
105 }
106
107 /**
108 * Sets the {@code scheme} attribute.
109 * @param scheme the {@code scheme} attribute
110 */
111 @JsxSetter
112 public void setScheme(final String scheme) {
113 getDomNodeOrDie().setAttribute("scheme", scheme);
114 }
115
116 /**
117 * @return the {@code meta} attribute
118 */
119 @JsxGetter
120 public String getMedia() {
121 return getDomNodeOrDie().getAttribute("media");
122 }
123
124 /**
125 * @param media the media attribute
126 */
127 @JsxSetter
128 public void setMedia(final String media) {
129 getDomNodeOrDie().setAttribute("media", media);
130 }
131
132 /**
133 * {@inheritDoc}
134 */
135 @Override
136 protected boolean isEndTagForbidden() {
137 return true;
138 }
139 }