FluentDOM
[ class tree: FluentDOM ] [ index: FluentDOM ] [ all elements ]

Class: FluentDOM

Source Location: /FluentDOM.php

Class Overview

FluentDOMCore
   |
   --FluentDOM

FluentDOM implements a jQuery like replacement for DOMNodeList


Author(s):

Methods


Child classes:

FluentDOMStyle
FluentDOMStyle extends the FluentDOM class with a function to edit the style attribute of html tags

Inherited Variables

Inherited Methods

Class: FluentDOMCore

FluentDOMCore::__construct()
Constructor
FluentDOMCore::count()
Get element count (Countable interface)
FluentDOMCore::evaluate()
Gives access to an xpath evaluate on the current document
FluentDOMCore::formatOutput()
Formats the current document, resets internal node array and other properties.
FluentDOMCore::getIterator()
Get an iterator for this object.
FluentDOMCore::item()
The item() method is used to access elements in the node list, like in a DOMNodelist.
FluentDOMCore::load()
Load a $source. The type of the source depends on the loaders. If no explicit loaders are set FluentDOM will use a set of default loaders for xml/html and DOM.
FluentDOMCore::namespaces()
Register namespaces and or get namespaces
FluentDOMCore::offsetExists()
Check if index exists in internal array
FluentDOMCore::offsetGet()
Get element from internal array
FluentDOMCore::offsetSet()
If somebody tries to modify the internal array throw an exception.
FluentDOMCore::offsetUnset()
If somebody tries to remove an element from the internal array throw an exception.
FluentDOMCore::push()
Push new element(s) an the internal element list
FluentDOMCore::setLoaders()
Define own loading handlers
FluentDOMCore::spawn()
Create a new instance of the same class with $this as the parent. This is used for the chaining.
FluentDOMCore::unique()
Sorts an array of DOM nodes based on document position, in place, with the duplicates removed.
FluentDOMCore::_applyContentToNodes()
Use a handler callback to apply a content argument to each node $targetNodes. The content argument can be an easy setter function
FluentDOMCore::_executeEasySetter()
Execute the easy setter function for a node and return the new elements
FluentDOMCore::_getContentElement()
Convert $content to a DOMElement. If $content contains several elements use the first.
FluentDOMCore::_getContentFragment()
Convert a given content xml string into and array of nodes
FluentDOMCore::_getContentNodes()
Convert a given content into and array of nodes
FluentDOMCore::_getContextNodes()
FluentDOMCore::_getHandler()
Get the class/object providing the handler functions
FluentDOMCore::_getInnerXml()
Get the inner xml of a given node or in other words the xml of all children.
FluentDOMCore::_getTargetNodes()
Get the target nodes from a given $selector.
FluentDOMCore::_initLoaders()
Initialize default loaders if they are not already initialized
FluentDOMCore::_inList()
Check if object is already in internal list
FluentDOMCore::_isCallback()
check if parameter is a valid callback function
FluentDOMCore::_isNCName()
Validate string as qualified node name part (namespace or local name)
FluentDOMCore::_isNode()
Check if the DOMNode is DOMElement or DOMText with content
FluentDOMCore::_isNodeList()
Check if $elements is a iterateable node list
FluentDOMCore::_isQName()
Validate string as qualified node name
FluentDOMCore::_match()
Match XPath expression agains context and return matched elements.
FluentDOMCore::_removeNodes()
Remove nodes from document tree
FluentDOMCore::_setContentType()
Setter for FluentDOM::_contentType property
FluentDOMCore::_test()
Test xpath expression against context and return true/false
FluentDOMCore::_uniqueSort()
Sorts the selected nodes, with the duplicates removed.
FluentDOMCore::_xpath()
Get a XPath object associated with the internal DOMDocument and register default namespaces from the document element if availiable.
FluentDOMCore::__get()
implement dynamic properties using magic methods
FluentDOMCore::__isset()
support isset for dynamic properties length and document
FluentDOMCore::__set()
block changes of dynamic readonly property length
FluentDOMCore::__toString()
Return the XML output of the internal dom document

Class Details

[line 47]
FluentDOM implements a jQuery like replacement for DOMNodeList

*




Tags:

method:  bool empty(): Remove all child nodes from the set of matched elements.
method:  DOMDocument clone(): Clone matched DOM Elements and select the clones.


[ Top ]


Class Methods


method add [line 334]

FluentDOM add( string $expr, [ $context = NULL])

Adds more elements, matched by the given expression, to the set of matched elements.



Tags:

access:  public
example:  Usage Examples: FluentDOM::add()


Parameters:

string   $expr   XPath expression
   $context  

[ Top ]

method addClass [line 1345]

FluentDOM addClass( string|callback|Closure $class)

Adds the specified class(es) to each of the set of matched elements.



Tags:

access:  public


Parameters:

string|callback|Closure   $class  

[ Top ]

method after [line 914]

FluentDOM after( string|array|DOMNode|DOMNodeList|Iterator|callback|Closure $content)

Insert content after each of the matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::after()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator|callback|Closure   $content  

[ Top ]

method andSelf [line 699]

FluentDOM andSelf( )

Add the previous selection to the current selection.



Tags:

access:  public


[ Top ]

method append [line 811]

FluentDOM append( string|array|DOMNode|Iterator $content)

Append content to the inside of every matched element.



Tags:

access:  public
example:  Usage Example: FluentDOM::append()


Parameters:

string|array|DOMNode|Iterator   $content   DOMNode or DOMNodeList or xml fragment string

[ Top ]

method appendTo [line 844]

FluentDOM appendTo( string|array|DOMNode|DOMNodeList|FluentDOM $selector)

Append all of the matched elements to another, specified, set of elements.

Returns all of the inserted elements.




Tags:

access:  public
example:  Usage Example: FluentDOM::appendTo()


Parameters:

string|array|DOMNode|DOMNodeList|FluentDOM   $selector  

[ Top ]

method attr [line 1251]

string|FluentDOM attr( string|array $attribute, [string|callback|Closure $value = NULL])

Access a property on the first matched element or set the attribute(s) of all matched elements



Tags:

return:  attribute value or $this
access:  public
example:  Usage Example: FluentDOM:attr() Read an attribute value.


Parameters:

string|array   $attribute   attribute name or attribute list
string|callback|Closure   $value   function callback($index, $value) or value

[ Top ]

method before [line 931]

FluentDOM before( string|array|DOMNode|DOMNodeList|Iterator|callback|Closure $content)

Insert content before each of the matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::before()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator|callback|Closure   $content  

[ Top ]

method children [line 363]

FluentDOM children( [string $expr = NULL])

Get a set of elements containing of the unique immediate childnodes including only elements (not textnodes) of each of the matched set of elements.



Tags:

access:  public
example:  Usage Examples: FluentDOM::children()


Parameters:

string   $expr   XPath expression

[ Top ]

method closest [line 657]

FluentDOM closest( string $expr, [ $context = NULL])

Get a set of elements containing the closest parent element that matches the specified selector, the starting element included.



Tags:

access:  public
example:  Usage Example: FluentDOM::closest()


Parameters:

string   $expr   XPath expression
   $context  

[ Top ]

method contents [line 386]

FluentDOM contents( )

Get a set of elements containing all of the unique immediate childnodes including elements and textnodes of each of the matched set of elements.



Tags:

access:  public


[ Top ]

method each [line 76]

FluentDOM each( callback $function)

Execute a function within the context of every matched element.



Tags:

access:  public


Parameters:

callback   $function  

[ Top ]

method end [line 712]

FluentDOM end( )

Revert the most recent traversing operation, changing the set of matched elements to its previous state.



Tags:

access:  public


[ Top ]

method eq [line 109]

FluentDOM eq( integer $position)

Reduce the set of matched elements to a single element.



Tags:

access:  public
example:  Usage Example: FluentDOM::eq()


Parameters:

integer   $position   Element index (start with 0)

[ Top ]

method filter [line 129]

FluentDOM filter( string|callback $expr)

Removes all elements from the set of matched elements that do not match the specified expression(s).



Tags:



Parameters:

string|callback   $expr   XPath expression or callback function

[ Top ]

method find [line 403]

FluentDOM find( string $expr, [boolean $useDocumentContext = FALSE])

Searches for descendent elements that match the specified expression.



Tags:

access:  public
example:  Usage Example: FluentDOM::find()


Parameters:

string   $expr   XPath expression
boolean   $useDocumentContext   ignore current node list

[ Top ]

method first [line 677]

FluentDOM first( )

Get a set of elements containing only the first of the currently selected elements.



Tags:

access:  public


[ Top ]

method get [line 151]

array() get( [integer|NULL $position = NULL])

Retrieve the matched DOM elements in an array. A negative position will be counted from the end.



Tags:

access:  public


Parameters:

integer|NULL   $position   optional offset of a single element to get.

[ Top ]

method has [line 208]

boolean has( string|DOMNode $expr)

Reduce the set of matched elements to those that have a descendant that matches the selector or DOM element.



Tags:

access:  public


Parameters:

string|DOMNode   $expr   XPath expression or DOMNode

[ Top ]

method hasClass [line 1355]

boolean hasClass( string|callback|Closure $class)

Returns true if the specified class is present on at least one of the set of matched elements.



Tags:

access:  public


Parameters:

string|callback|Closure   $class  

[ Top ]

method index [line 171]

integer index( [NULL|string|DOMNode|DOMNodelist|Iterator $expr = NULL])

Search for a given element from among the matched elements.



Tags:

access:  public


Parameters:

NULL|string|DOMNode|DOMNodelist|Iterator   $expr  

[ Top ]

method insertAfter [line 948]

FluentDOM insertAfter( string|array|DOMNode|DOMNodeList|Iterator $selector)

Insert all of the matched elements after another, specified, set of elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::insertAfter()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator   $selector  

[ Top ]

method insertBefore [line 971]

FluentDOM insertBefore( string|array|DOMNode|DOMNodeList|Iterator $selector)

Insert all of the matched elements before another, specified, set of elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::insertBefore()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator   $selector  

[ Top ]

method is [line 236]

boolean is( string $expr)

Checks the current selection against an expression and returns true, if at least one element of the selection fits the given expression.



Tags:

access:  public
example:  Usage Example: FluentDOM::is()


Parameters:

string   $expr   XPath expression

[ Top ]

method last [line 686]

FluentDOM last( )

Get a set of elements containing only the last of the currently selected elements.



Tags:

access:  public


[ Top ]

method map [line 254]

array map( callback $function)

Translate a set of elements in the FluentDOM object into another set of values in an array (which may, or may not contain elements).

If the callback function returns an array each element of the array will be added to the result array. All other variable types are put directly into the result array.




Tags:

access:  public
example:  Usage Example: FluentDOM::map()


Parameters:

callback   $function  

[ Top ]

method next [line 424]

FluentDOM next( [string $expr = NULL])

Get a set of elements containing the unique next siblings of each of the given set of elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::next()


Parameters:

string   $expr   XPath expression

[ Top ]

method nextAll [line 448]

FluentDOM nextAll( [string $expr = NULL])

Find all sibling elements after the current element.



Tags:

access:  public
example:  Usage Example: FluentDOM::nextAll()


Parameters:

string   $expr   XPath expression

[ Top ]

method nextUntil [line 471]

FluentDOM nextUntil( [string $expr = NULL])

Get all following siblings of each element up to but not including the element matched by the selector.



Tags:

access:  public


Parameters:

string   $expr   XPath expression

[ Top ]

method not [line 285]

FluentDOM not( string|callback $expr)

Removes elements matching the specified expression from the set of matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::not()


Parameters:

string|callback   $expr   XPath expression or callback function

[ Top ]

method parent [line 495]

FluentDOM parent( )

Get a set of elements containing the unique parents of the matched set of elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::parent()


[ Top ]

method parents [line 514]

FluentDOM parents( [string $expr = NULL])

Get the ancestors of each element in the current set of matched elements, optionally filtered by a selector.



Tags:

access:  public
example:  Usage Example: FluentDOM::parents()


Parameters:

string   $expr   XPath expression

[ Top ]

method parentsUntil [line 535]

FluentDOM parentsUntil( [string $expr = NULL])

Get the ancestors of each element in the current set of matched elements, up to but not including the element matched by the selector.



Tags:

access:  public


Parameters:

string   $expr   XPath expression

[ Top ]

method prepend [line 867]

FluentDOM prepend( string|array|DOMNode|Iterator $content)

Prepend content to the inside of every matched element.



Tags:

access:  public
example:  Usage Example: FluentDOM::prepend()


Parameters:

string|array|DOMNode|Iterator   $content  

[ Top ]

method prependTo [line 887]

FluentDOM prependTo( string|array|DOMNode|DOMNodeList|FluentDOM $selector)

Prepend all of the matched elements to another, specified, set of elements.

Returns all of the inserted elements.




Tags:

return:  list of all new elements
access:  public
example:  Usage Example: FluentDOM::prependTo()


Parameters:

string|array|DOMNode|DOMNodeList|FluentDOM   $selector  

[ Top ]

method prev [line 558]

FluentDOM prev( [string $expr = NULL])

Get a set of elements containing the unique previous siblings of each of the matched set of elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::prev()


Parameters:

string   $expr   XPath expression

[ Top ]

method prevAll [line 582]

FluentDOM prevAll( [string $expr = NULL])

Find all sibling elements in front of the current element.



Tags:

access:  public
example:  Usage Example: FluentDOM::prevAll()


Parameters:

string   $expr   XPath expression

[ Top ]

method prevUntil [line 605]

FluentDOM prevUntil( [string $expr = NULL])

Get all preceding siblings of each element up to but not including the element matched by the selector.



Tags:

access:  public


Parameters:

string   $expr   XPath expression

[ Top ]

method remove [line 1201]

FluentDOM remove( [string $expr = NULL])

Removes all matched elements from the DOM.



Tags:

return:  removed elements
access:  public
example:  Usage Example: FluentDOM::remove()


Parameters:

string   $expr   XPath expression

[ Top ]

method removeAttr [line 1307]

FluentDOM removeAttr( string $name)

Remove an attribute from each of the matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::removeAttr()


Parameters:

string   $name  

[ Top ]

method removeClass [line 1374]

FluentDOM removeClass( [string|callback|Closure $class = ''])

Removes all or the specified class(es) from the set of matched elements.



Tags:

access:  public


Parameters:

string|callback|Closure   $class  

[ Top ]

method replaceAll [line 1155]

FluentDOM replaceAll( string|array|DOMNode|DOMNodeList|Iterator $selector)

Replaces the elements matched by the specified selector with the matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::replaceAll()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator   $selector  

[ Top ]

method replaceWith [line 1139]

FluentDOM replaceWith( string|array|DOMNode|DOMNodeList|Iterator|callback|Closure $content)

Replaces all matched elements with the specified HTML or DOM elements.

This returns the JQuery element that was just replaced, which has been removed from the DOM.




Tags:

access:  public
example:  Usage Example: FluentDOM::replaceWith()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator|callback|Closure   $content  

[ Top ]

method siblings [line 631]

FluentDOM siblings( [string $expr = NULL])

Get a set of elements containing all of the unique siblings of each of the matched set of elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::siblings()


Parameters:

string   $expr   XPath expression

[ Top ]

method slice [line 309]

FluentDOM slice( integer $start, [integer $end = NULL])

Selects a subset of the matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::slice()


Parameters:

integer   $start  
integer   $end  

[ Top ]

method text [line 780]

string|FluentDOM text( [string|callback|Closure $text = NULL])

Get the combined text contents of all matched elements or set the text contents of all matched elements.



Tags:

access:  public
example:  Usage Example: FluentDOM::text()


Parameters:

string|callback|Closure   $text  

[ Top ]

method toArray [line 94]

array toArray( )

Retrieve the matched DOM elements in an array.



Tags:

access:  public


[ Top ]

method toggleClass [line 1388]

FluentDOM toggleClass( string|callback|Closure $class, [NULL|boolean $switch = NULL])

Adds the specified class if the switch is TRUE, removes the specified class if the switch is FALSE, toggles the specified class if the switch is NULL.



Tags:

access:  public
example:  Usage Example: FluentDOM::toggleClass()


Parameters:

string|callback|Closure   $class  
NULL|boolean   $switch   toggle if NULL, add if TRUE, remove if FALSE

[ Top ]

method wrap [line 1043]

FluentDOM wrap( string|array|DOMNode|DOMNodeList|Iterator|callback|Closure $content)

Wrap each matched element with the specified content.

If $content contains several elements the first one is used




Tags:

access:  public
example:  Usage Example: FluentDOM::wrap()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator|callback|Closure   $content  

[ Top ]

method wrapAll [line 1058]

FluentDOM wrapAll( string|array|DOMNode|Iterator $content)

Wrap al matched elements with the specified content

If the matched elemetns are not siblings, wrap each group of siblings.




Tags:

access:  public
example:  Usage Example: FluentDOM::wrapAll()


Parameters:

string|array|DOMNode|Iterator   $content  

[ Top ]

method wrapInner [line 1112]

FluentDOM wrapInner( string|array|DOMNode|DOMNodeList|Iterator $content)

Wrap the inner child contents of each matched element (including text nodes) with an XML structure.



Tags:

access:  public
example:  Usage Example: FluentDOM::wrapInner()


Parameters:

string|array|DOMNode|DOMNodeList|Iterator   $content  

[ Top ]

method xml [line 731]

string|FluentDOM xml( [string|Callback|Closure $xml = NULL])

Get or set the xml contents of the first matched element.



Tags:

access:  public
example:  Usage Example: FluentDOM::xml()


Parameters:

string|Callback|Closure   $xml   XML fragment

[ Top ]

method _cloneNodes [line 1231]

FluentDOM _cloneNodes( )

Clone matched DOM Elements and select the clones.

This is the clone() method - but because clone is a reserved word we can no declare it directly




Tags:

see:  FluentDOM::__call()
access:  protected
example:  Usage Example: FluentDOM:clone()


[ Top ]

method _emptyNodes [line 1184]

FluentDOM _emptyNodes( )

Remove all child nodes from the set of matched elements.

This is the empty() method - but because empty is a reserved word we can no declare it directly




Tags:

see:  FluentDOM::__call()
access:  protected
example:  Usage Example: FluentDOM:empty()


[ Top ]

method _wrap [line 998]

FluentDOM _wrap( array $elements, string|array|DOMNode|DOMNodeList|Iterator|callback|Closure $content)

Wrap $content around a set of elements



Tags:

access:  protected


Parameters:

array   $elements  
string|array|DOMNode|DOMNodeList|Iterator|callback|Closure   $content  

[ Top ]

method __call [line 56]

mixed __call( string $name, array $arguments)

declaring an empty() or clone() method will crash the parser so we use some magic



Tags:

access:  public


Parameters:

string   $name  
array   $arguments  

[ Top ]


Documentation generated on Fri, 30 Jul 2010 01:00:46 +0200 by phpDocumentor 1.4.3