The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Eg::Node::Element - Element in JavaScript.

Description

The Eg::Node::Element class in SPVM is the most general base class from which all element objects.

This class is a port of Element in JavaScript.

Usage

  use Eg::Node::Element;
  
  my $xml_document = Eg->document->implementation->create_document(
    "http://www.w3.org/1999/xhtml",
    "html",
  );
  
  my $element = $xml_document->create_element("div");

Inheritance

Eg::Node

Fields

namespace_uri

has namespace_uri : ro protected string;

The namespace URI of the element.

For details, see Element.namespaceURI in JavaScript.

Instance Methods

get_attribute

method get_attribute : string ($name : string);

Returns the value of a specified attribute on the element.

For details, see Element.getAttribute in JavaScript.

set_attribute

method set_attribute : void ($name : string, $value : string);

Sets the value of an attribute on the specified element.

For details, see Element.setAttribute in JavaScript.

remove_attribute

method remove_attribute : void ($name : string);

Removes the attribute with the specified name from the element.

For details, see Element.removeAttribute in JavaScript.

has_attribute

method has_attribute : int ($name : string);

Returns a boolean value indicating whether the specified element has the specified attribute or not.

For details, see Element.hasAttribute in JavaScript.

get_attribute_names

method get_attribute_names : string[] ();

Returns the attribute names of the element as an array of strings.

For details, see Element.getAttributeNames in JavaScript.

tag_name

method tag_name : string ();

Returns the tag name of the element on which it's called.

For details, see Element.tagName in JavaScript.

Well Known Classes

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License