PHP Classes

File: classes/css-parser/filters/css-id-filter.php

Recommend this page to a friend!
  Classes of Gonzalo Chumillas   PHP CSS Parser   classes/css-parser/filters/css-id-filter.php   Download  
File: classes/css-parser/filters/css-id-filter.php
Role: Class source
Content type: text/plain
Description: CSSIdFilter class
Class: PHP CSS Parser
Get HTML document nodes matching a CSS selector
Author: By
Last change: Merge branch 'master' of https://github.com/cequiel/cssparser
update
Date: 10 years ago
Size: 518 bytes
 

Contents

Class file image Download
<?php
require_once dirname(dirname(__DIR__)) . "/css-parser/filters/css-filter.php";

class
CSSIdFilter extends CSSFilter {
   
/**
     * Identifier.
     * @var string
     */
   
private $id;
   
   
/**
     * @param string $id
     */
   
public function __construct($id) {
       
$this->id = $id;
    }
   
   
/**
     * Does the node match?
     * @param DOMElement $node
     * @return boolean
     */
   
public function match($node) {
        return
trim($node->getAttribute("id")) == $this->id;
    }
}