1 module webkit2webextension.DOMDocumentFragment;
2 
3 private import glib.ErrorG;
4 private import glib.GException;
5 private import glib.Str;
6 private import gobject.ObjectG;
7 private import webkit2webextension.DOMElement;
8 private import webkit2webextension.DOMHTMLCollection;
9 private import webkit2webextension.DOMNode;
10 private import webkit2webextension.DOMNodeList;
11 private import webkit2webextension.c.functions;
12 public  import webkit2webextension.c.types;
13 
14 
15 /** */
16 public class DOMDocumentFragment : DOMNode
17 {
18 	/** the main Gtk struct */
19 	protected WebKitDOMDocumentFragment* webKitDOMDocumentFragment;
20 
21 	/** Get the main Gtk struct */
22 	public WebKitDOMDocumentFragment* getDOMDocumentFragmentStruct(bool transferOwnership = false)
23 	{
24 		if (transferOwnership)
25 			ownedRef = false;
26 		return webKitDOMDocumentFragment;
27 	}
28 
29 	/** the main Gtk struct as a void* */
30 	protected override void* getStruct()
31 	{
32 		return cast(void*)webKitDOMDocumentFragment;
33 	}
34 
35 	/**
36 	 * Sets our main struct and passes it to the parent class.
37 	 */
38 	public this (WebKitDOMDocumentFragment* webKitDOMDocumentFragment, bool ownedRef = false)
39 	{
40 		this.webKitDOMDocumentFragment = webKitDOMDocumentFragment;
41 		super(cast(WebKitDOMNode*)webKitDOMDocumentFragment, ownedRef);
42 	}
43 
44 
45 	/** */
46 	public static GType getType()
47 	{
48 		return webkit_dom_document_fragment_get_type();
49 	}
50 
51 	/**
52 	 *
53 	 *
54 	 * Deprecated: Use JavaScriptCore API instead
55 	 *
56 	 * Returns: A #gulong
57 	 *
58 	 * Since: 2.16
59 	 */
60 	public gulong getChildElementCount()
61 	{
62 		return webkit_dom_document_fragment_get_child_element_count(webKitDOMDocumentFragment);
63 	}
64 
65 	/**
66 	 *
67 	 *
68 	 * Deprecated: Use JavaScriptCore API instead
69 	 *
70 	 * Returns: A #WebKitDOMHTMLCollection
71 	 *
72 	 * Since: 2.16
73 	 */
74 	public DOMHTMLCollection getChildren()
75 	{
76 		auto __p = webkit_dom_document_fragment_get_children(webKitDOMDocumentFragment);
77 
78 		if(__p is null)
79 		{
80 			return null;
81 		}
82 
83 		return ObjectG.getDObject!(DOMHTMLCollection)(cast(WebKitDOMHTMLCollection*) __p, true);
84 	}
85 
86 	/**
87 	 *
88 	 *
89 	 * Deprecated: Use JavaScriptCore API instead
90 	 *
91 	 * Params:
92 	 *     elementId = A #gchar
93 	 *
94 	 * Returns: A #WebKitDOMElement
95 	 *
96 	 * Since: 2.16
97 	 */
98 	public DOMElement getElementById(string elementId)
99 	{
100 		auto __p = webkit_dom_document_fragment_get_element_by_id(webKitDOMDocumentFragment, Str.toStringz(elementId));
101 
102 		if(__p is null)
103 		{
104 			return null;
105 		}
106 
107 		return ObjectG.getDObject!(DOMElement)(cast(WebKitDOMElement*) __p);
108 	}
109 
110 	/**
111 	 *
112 	 *
113 	 * Deprecated: Use JavaScriptCore API instead
114 	 *
115 	 * Returns: A #WebKitDOMElement
116 	 *
117 	 * Since: 2.16
118 	 */
119 	public DOMElement getFirstElementChild()
120 	{
121 		auto __p = webkit_dom_document_fragment_get_first_element_child(webKitDOMDocumentFragment);
122 
123 		if(__p is null)
124 		{
125 			return null;
126 		}
127 
128 		return ObjectG.getDObject!(DOMElement)(cast(WebKitDOMElement*) __p);
129 	}
130 
131 	/**
132 	 *
133 	 *
134 	 * Deprecated: Use JavaScriptCore API instead
135 	 *
136 	 * Returns: A #WebKitDOMElement
137 	 *
138 	 * Since: 2.16
139 	 */
140 	public DOMElement getLastElementChild()
141 	{
142 		auto __p = webkit_dom_document_fragment_get_last_element_child(webKitDOMDocumentFragment);
143 
144 		if(__p is null)
145 		{
146 			return null;
147 		}
148 
149 		return ObjectG.getDObject!(DOMElement)(cast(WebKitDOMElement*) __p);
150 	}
151 
152 	/**
153 	 *
154 	 *
155 	 * Deprecated: Use JavaScriptCore API instead
156 	 *
157 	 * Params:
158 	 *     selectors = A #gchar
159 	 *
160 	 * Returns: A #WebKitDOMElement
161 	 *
162 	 * Since: 2.16
163 	 *
164 	 * Throws: GException on failure.
165 	 */
166 	public DOMElement querySelector(string selectors)
167 	{
168 		GError* err = null;
169 
170 		auto __p = webkit_dom_document_fragment_query_selector(webKitDOMDocumentFragment, Str.toStringz(selectors), &err);
171 
172 		if (err !is null)
173 		{
174 			throw new GException( new ErrorG(err) );
175 		}
176 
177 		if(__p is null)
178 		{
179 			return null;
180 		}
181 
182 		return ObjectG.getDObject!(DOMElement)(cast(WebKitDOMElement*) __p);
183 	}
184 
185 	/**
186 	 *
187 	 *
188 	 * Deprecated: Use JavaScriptCore API instead
189 	 *
190 	 * Params:
191 	 *     selectors = A #gchar
192 	 *
193 	 * Returns: A #WebKitDOMNodeList
194 	 *
195 	 * Since: 2.16
196 	 *
197 	 * Throws: GException on failure.
198 	 */
199 	public DOMNodeList querySelectorAll(string selectors)
200 	{
201 		GError* err = null;
202 
203 		auto __p = webkit_dom_document_fragment_query_selector_all(webKitDOMDocumentFragment, Str.toStringz(selectors), &err);
204 
205 		if (err !is null)
206 		{
207 			throw new GException( new ErrorG(err) );
208 		}
209 
210 		if(__p is null)
211 		{
212 			return null;
213 		}
214 
215 		return ObjectG.getDObject!(DOMNodeList)(cast(WebKitDOMNodeList*) __p, true);
216 	}
217 }