Struct moxie_dom::elements::metadata::LinkBuilder [−][src]
pub struct LinkBuilder { /* fields omitted */ }
Expand description
The HTML External Resource Link element (<link>
) specifies relationships between
the current document and an external resource. This element is most commonly used to link to
stylesheets, but is also used to establish site icons (both “favicon” style icons and
icons for the home screen and apps on mobile devices) among other things.
A type for initializing the element’s attributes before calling build
.
Implementations
This attribute is only used when rel=“preload” or rel=“prefetch” has been set on the
<link>
element. It specifies the type of content being loaded by the <link>
, which is
necessary for request matching, application of correct content security policy, and
setting of correct Accept request header. Furthermore, rel=“preload” uses this as a
signal for request prioritization. The table below lists the valid values for this
attribute and the elements or resources they apply to.
Value | Applies To |
---|---|
audio | <audio> elements |
document | <iframe> and <frame> elements |
embed | <embed> elements |
fetch | fetch, XHR (also requires <link> to contain the crossorigin attribute.) |
font | CSS @font-face |
image | <img> and <picture> elements with srcset or imageset attributes, |
SVG <image> elements, CSS *-image rules | |
object | <object> elements |
script | <script> elements, Worker importScripts |
style | <link rel=stylesheet> elements, CSS @import |
track | <track> elements |
video | <video> elements |
worker | Worker, SharedWorker |
This enumerated attribute indicates whether CORS must be used when fetching the
resource. CORS-enabled images can be reused in the <canvas>
element without being
tainted. The allowed values are:
anonymous
: A cross-origin request (i.e. with an Origin HTTP header) is performed, but no credential is sent (i.e. no cookie, X.509 certificate, or HTTP Basic authentication). If the server does not give credentials to the origin site (by not setting the Access-Control-Allow-Origin HTTP header) the resource will be tainted and its usage restricted.use-credentials
: A cross-origin request (i.e. with an Origin HTTP header) is performed along with a credential sent (i.e. a cookie, certificate, and/or HTTP Basic authentication is performed). If the server does not give credentials to the origin site (through Access-Control-Allow-Credentials HTTP header), the resource will be tainted and its usage restricted.
If the attribute is not present, the resource is fetched without a CORS request (i.e. without sending the Origin HTTP header), preventing its non-tainted usage. If invalid, it is handled as if the enumerated keyword anonymous was used.
For rel=“stylesheet” only, the disabled Boolean attribute indicates whether or not the described stylesheet should be loaded and applied to the document. If disabled is specified in the HTML when it is loaded, the stylesheet will not be loaded during page load. Instead, the stylesheet will be loaded on-demand, if and when the disabled attribute is changed to false or removed.
Once the stylesheet has been loaded, however, changes made to the value of the disabled property no longer have any relationship to the value of the StyleSheet.disabled property. Changing the value of this property instead simply enables and disables the stylesheet form being applied to the document.
This differs from StyleSheet’s disabled property; changing it to true removes the stylesheet from the document’s document.styleSheets list, and doesn’t automatically reload the stylesheet when it’s toggled back to false.
This attribute specifies the URL of the linked resource. A URL can be absolute or relative.
This attribute indicates the language of the linked resource. It is purely advisory. Allowed values are determined by BCP47. Use this attribute only if the href attribute is present.
This attribute specifies the media that the linked resource applies to. Its value must be a media type / media query. This attribute is mainly useful when linking to external stylesheets — it allows the user agent to pick the best adapted one for the device it runs on.
This attribute names a relationship of the linked document to the current document. The attribute must be a space-separated list of link type values.
This attribute defines the sizes of the icons for visual media contained in the resource. It must be present only if the rel contains a value of icon or a non-standard type such as Apple’s apple-touch-icon. It may have the following values:
any
, meaning that the icon can be scaled to any size as it is in a vector format, like image/svg+xml.- a white-space separated list of sizes, each in the format
x or X . Each of these sizes must be contained in the resource.
Note: Most icon formats are only able to store one single icon; therefore most of the time the sizes attribute contains only one entry. MS’s ICO format does, as well as Apple’s ICNS. ICO is more ubiquitous, so you should use this format if cross-browser support is a concern (especially for old IE versions).
The title attribute has special semantics on the <link>
element. When used on a
<link rel="stylesheet">
it defines a preferred or an alternate stylesheet. Incorrectly
using it may cause the stylesheet to be ignored.
This attribute is used to define the type of the content linked to. The value of the attribute should be a MIME type such as text/html, text/css, and so on. The common use of this attribute is to define the type of stylesheet being referenced (such as text/css), but given that CSS is the only stylesheet language used on the web, not only is it possible to omit the type attribute, but is actually now recommended practice. It is also used on rel=“preload” link types, to make sure the browser only downloads file types that it supports.
Trait Implementations
Declare an attribute of the element, mutating the actual element’s attribute when the passed value changes. Read more
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Set an event handler.
Keyboard shortcut to activate or add focus to the element.
Sets whether input is automatically capitalized when entered by user. It can have the following values: Read more
A value of “true” means the element is editable and a value of “false” means it isn’t.
The directionality of the element. It can have the following values: Read more
Indicates if the element is hidden or not.
Indicates whether the user agent must act as though the given node is absent for the purposes of user interaction events, in-page text searches (“find in page”), and text selection. Read more
Provides a hint as to the type of data that might be entered by the user while editing the element or its contents. The attribute can be used with form controls (such as the value of textarea elements), or in elements in an editing host (e.g., using contenteditable attribute). Read more
The language of an element’s attributes, text, and element contents.
Assigns a slot in a shadow DOM shadow tree to an element.
Indicates whether spell checking is allowed for the element.
Overrides the browser’s default tab order and follows the one specified instead. Read more
Retrieves access to the raw HTML element underlying the (CachedNode). Read more
Auto Trait Implementations
impl !RefUnwindSafe for LinkBuilder
impl !Send for LinkBuilder
impl !Sync for LinkBuilder
impl Unpin for LinkBuilder
impl !UnwindSafe for LinkBuilder
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more