Struct silkenweb::elements::LinkBuilder[][src]

pub struct LinkBuilder(_);

Implementations

impl LinkBuilder[src]

pub fn id(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

pub fn class(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

pub fn as_(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

ValueApplies To
audio<audio> elements
document<iframe> and <frame> elements
embed<embed> elements
fetchfetch, XHR (also requires <link> to contain the crossorigin attribute.)
fontCSS @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
workerWorker, SharedWorker

pub fn crossorigin(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

pub fn disabled(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

pub fn href(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

This attribute specifies the URL of the linked resource. A URL can be absolute or relative.

pub fn hreflang(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

pub fn media(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

pub fn rel(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

pub fn sizes(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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).

pub fn title(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

pub fn type_(self, value: impl AttributeValue<String>) -> LinkBuilder[src]

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.

impl LinkBuilder[src]

pub fn on_blur(
    self,
    f: impl FnMut(FocusEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_click(
    self,
    f: impl FnMut(MouseEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_change(
    self,
    f: impl FnMut(Event, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_dblclick(
    self,
    f: impl FnMut(MouseEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_focusout(
    self,
    f: impl FnMut(FocusEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_input(
    self,
    f: impl FnMut(InputEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_keydown(
    self,
    f: impl FnMut(KeyboardEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn on_keyup(
    self,
    f: impl FnMut(KeyboardEvent, HtmlLinkElement) + 'static
) -> LinkBuilder
[src]

pub fn effect(self, f: impl Effect<HtmlLinkElement>) -> LinkBuilder[src]

Trait Implementations

impl Builder for LinkBuilder[src]

type Target = Link

impl DomElement for LinkBuilder[src]

impl From<LinkBuilder> for ElementBuilder[src]

impl From<LinkBuilder> for Element[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.