Search in sources :

Example 1 with HTMLMetaElement

use of elemental2.dom.HTMLMetaElement in project nalu by NaluKit.

the class NaluPluginElemento method updateMetaPropertyContent.

@Override
public void updateMetaPropertyContent(String property, String content) {
    NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta");
    for (int i = 0; i < metaTagList.length; i++) {
        if (metaTagList.item(i) instanceof HTMLMetaElement) {
            HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i);
            if (!Objects.isNull(nodeListElement.getAttribute("property"))) {
                if (nodeListElement.getAttribute("property").equals(property)) {
                    nodeListElement.remove();
                    break;
                }
            }
        }
    }
    HTMLMetaElement metaElement = (HTMLMetaElement) DomGlobal.document.createElement("meta");
    metaElement.setAttribute("property", property);
    metaElement.content = content;
    DomGlobal.document.head.appendChild(metaElement);
}
Also used : Element(elemental2.dom.Element) HTMLMetaElement(elemental2.dom.HTMLMetaElement) IsElement(org.jboss.elemento.IsElement) HTMLElement(elemental2.dom.HTMLElement) HTMLMetaElement(elemental2.dom.HTMLMetaElement)

Example 2 with HTMLMetaElement

use of elemental2.dom.HTMLMetaElement in project nalu by NaluKit.

the class NaluPluginElemental2 method updateMetaPropertyContent.

@Override
public void updateMetaPropertyContent(String property, String content) {
    NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta");
    for (int i = 0; i < metaTagList.length; i++) {
        if (metaTagList.item(i) instanceof HTMLMetaElement) {
            HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i);
            if (!Objects.isNull(nodeListElement.getAttribute("property"))) {
                if (nodeListElement.getAttribute("property").equals(property)) {
                    nodeListElement.remove();
                    break;
                }
            }
        }
    }
    HTMLMetaElement metaElement = (HTMLMetaElement) DomGlobal.document.createElement("meta");
    metaElement.setAttribute("property", property);
    metaElement.content = content;
    DomGlobal.document.head.appendChild(metaElement);
}
Also used : Element(elemental2.dom.Element) HTMLMetaElement(elemental2.dom.HTMLMetaElement) HTMLElement(elemental2.dom.HTMLElement) HTMLMetaElement(elemental2.dom.HTMLMetaElement)

Example 3 with HTMLMetaElement

use of elemental2.dom.HTMLMetaElement in project nalu by NaluKit.

the class NaluPluginElemental2 method updateMetaNameContent.

@Override
public void updateMetaNameContent(String name, String content) {
    NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta");
    for (int i = 0; i < metaTagList.length; i++) {
        if (metaTagList.item(i) instanceof HTMLMetaElement) {
            HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i);
            if (!Objects.isNull(nodeListElement.name)) {
                if (nodeListElement.name.equals(name)) {
                    nodeListElement.remove();
                    break;
                }
            }
        }
    }
    HTMLMetaElement metaTagElement = (HTMLMetaElement) DomGlobal.document.createElement("meta");
    metaTagElement.name = name;
    metaTagElement.content = content;
    DomGlobal.document.head.appendChild(metaTagElement);
}
Also used : Element(elemental2.dom.Element) HTMLMetaElement(elemental2.dom.HTMLMetaElement) HTMLElement(elemental2.dom.HTMLElement) HTMLMetaElement(elemental2.dom.HTMLMetaElement)

Example 4 with HTMLMetaElement

use of elemental2.dom.HTMLMetaElement in project nalu by NaluKit.

the class NaluPluginElemento method updateMetaNameContent.

@Override
public void updateMetaNameContent(String name, String content) {
    NodeList<Element> metaTagList = DomGlobal.document.getElementsByTagName("meta");
    for (int i = 0; i < metaTagList.length; i++) {
        if (metaTagList.item(i) instanceof HTMLMetaElement) {
            HTMLMetaElement nodeListElement = (HTMLMetaElement) metaTagList.item(i);
            if (!Objects.isNull(nodeListElement.name)) {
                if (nodeListElement.name.equals(name)) {
                    nodeListElement.remove();
                    break;
                }
            }
        }
    }
    HTMLMetaElement metaTagElement = (HTMLMetaElement) DomGlobal.document.createElement("meta");
    metaTagElement.name = name;
    metaTagElement.content = content;
    DomGlobal.document.head.appendChild(metaTagElement);
}
Also used : Element(elemental2.dom.Element) HTMLMetaElement(elemental2.dom.HTMLMetaElement) IsElement(org.jboss.elemento.IsElement) HTMLElement(elemental2.dom.HTMLElement) HTMLMetaElement(elemental2.dom.HTMLMetaElement)

Aggregations

Element (elemental2.dom.Element)4 HTMLElement (elemental2.dom.HTMLElement)4 HTMLMetaElement (elemental2.dom.HTMLMetaElement)4 IsElement (org.jboss.elemento.IsElement)2