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::Attr - Attr in JavaScript

Description

The Eg::Node::Attr class in SPVM represents one of an element's attributes as an object.

This class is a port of Attr in JavaScript.

Usage

  my $attr = Eg->document->create_attribute("class");
  
  my $attr = Eg->document->create_attribute_ns(
    "http://www.mozilla.org/ns/specialspace",
    "class"
  );
  
  my $name = $attr->name;
  
  my $value = $attr->value;
  
  my $namespace_uri = $attr->namespace_uri;

Inheritance

Eg::Node

Fields

name

has name : ro string;

Returns the qualified name of an attribute.

For details, see Attr.name in JavaScript.

value

has value : ro string;

method set_value : void ($value : string);

Returns and sets the value of the attribute.

For details, see Attr.value in JavaScript.

namespace_uri

has namespace_uri : ro string;

Returns the namespace URI of the attribute.

For details, see Attr.namespaceURI in JavaScript.

owner_element

has owner_element : ro Eg::Node::Element;

Returns the Element the attribute belongs to.

For details, see Attr.ownerElement in JavaScript.

Instance Method

local_name

  method local_name : string ();

Returns the local part of the qualified name of an attribute.

For details, see Attr.localName in JavaScript.

prefix

  method prefix : string ();

Returns the namespace prefix of the attribute.

For details, see Attr.prefix in JavaScript.

Copyright & License

Copyright (c) 2024 Yuki Kimoto

MIT License