Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cafe01/xml-libxml-jquery
Fast, jQuery-like DOM manipulation over XML::LibXML
https://github.com/cafe01/xml-libxml-jquery
Last synced: about 2 months ago
JSON representation
Fast, jQuery-like DOM manipulation over XML::LibXML
- Host: GitHub
- URL: https://github.com/cafe01/xml-libxml-jquery
- Owner: cafe01
- License: other
- Created: 2016-06-22T13:26:59.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2016-07-23T17:52:20.000Z (over 8 years ago)
- Last Synced: 2024-10-11T21:08:12.883Z (2 months ago)
- Language: Perl
- Homepage: https://metacpan.org/pod/XML::LibXML::jQuery
- Size: 55.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: Changes
- License: LICENSE
Awesome Lists containing this project
README
[![Build Status](https://travis-ci.org/cafe01/xml-libxml-jquery.svg?branch=master)](https://travis-ci.org/cafe01/xml-libxml-jquery) [![Coverage Status](https://img.shields.io/coveralls/cafe01/xml-libxml-jquery/master.svg?style=flat)](https://coveralls.io/r/cafe01/xml-libxml-jquery?branch=master)
# NAMEXML::LibXML::jQuery - Fast, jQuery-like DOM manipulation over XML::LibXML
# SYNOPSIS
use XML::LibXML::jQuery;
my $div = j(<
Hello World
...
...
HTML$div->find('h1')->text; # Hello World
$div->find('p')->size; # 2
# DESCRIPTION
XML::LibXML::jQuery is a jQuery-like DOM manipulation module build on top of
[XML::LibXML](https://metacpan.org/pod/XML::LibXML) for speed. The goal is to be as fast as possible, and as compatible
as possible with the javascript version of jQuery. Unlike similar modules,
web fetching functionality like `-`append($url)> was intentionally not implemented.# SIMILAR MODULES
Following is a list of similar CPAN modules.
- Web::Query::LibXML
[Web::Query::LibXML](https://metacpan.org/pod/Web::Query::LibXML) is my previous attempt to create a fast, jQuery-like module.
But since it uses [HTML::TreeBuilder::LibXML](https://metacpan.org/pod/HTML::TreeBuilder::LibXML) (for compatibility with [Web::Query](https://metacpan.org/pod/Web::Query))
for the underlying DOM system, its not as fast as if it used XML::LibXML directly.
Also, maintaining it was a bit of a pain because of the API contracts to [Web::Query](https://metacpan.org/pod/Web::Query)
and [HTML::TreeBuilder](https://metacpan.org/pod/HTML::TreeBuilder).- jQuery
[jQuery](https://metacpan.org/pod/jQuery) seemed to be the perfect candidade for me to use/contribute since its
a jQuery port implemented directly over XML::LibXML, but discarded the idea after
finding some issues. It was slower than Web::Query::LibXML for some methods, it
has its own css selector engine (whose code was a bit scary, I'd rather just
use HTML::Selector::XPath), invalid html output (spits xml) and even some broken
methods. Which obviously could be fixed, but honestly I didn't find its codebase
fun to work on.- Web::Query
[Web::Query](https://metacpan.org/pod/Web::Query) uses the pure perl DOM implementation [HTML::TreeBuilder](https://metacpan.org/pod/HTML::TreeBuilder), so its
slow.- pQuery
[pQuery](https://metacpan.org/pod/pQuery) is also built on top of [HTML::TreeBuilder](https://metacpan.org/pod/HTML::TreeBuilder), so..
# CONSTRUCTOR
## new
Parses a HTML source and returns a new [XML::LibXML::jQuery](https://metacpan.org/pod/XML::LibXML::jQuery) instance.
# EXPORTED FUNCTION
## j
A shortcut to [new](https://metacpan.org/pod/new).
# METHODS
Unless otherwise noted, all methods behave exactly like the javascript version.
## add
Implemented signatures:
- add(selector)
- add(selector, [context](https://metacpan.org/pod/XML::LibXML::jQuery))
- add(html)
- add([elements](https://metacpan.org/pod/XML::LibXML::Node))
- add([selection](https://metacpan.org/pod/XML::LibXML::jQuery))Documentation and examples at [http://api.jquery.com/add/](http://api.jquery.com/add/).
## add\_class
Implemented signatures:
- add\_class(className)
- add\_class(function)Documentation and examples at [http://api.jquery.com/addClass/](http://api.jquery.com/addClass/).
## after
Implemented signatures:
- after(content\[, content\])
- after(function)Documentation and examples at [http://api.jquery.com/after/](http://api.jquery.com/after/).
## append
## append\_to
## as\_html
## attr
## before
## children
## clone
## contents
## data
Implemented signatures:
- data(key, value)
- data(key)
- data(obj)Documentation and examples at [http://api.jquery.com/data/](http://api.jquery.com/data/).
## detach
## document
## each
## eq
## end
## find
## get
## html
## insert\_after
Implemented signatures:
- insert\_after(target)
All targets supported: selector, element, array of elements, HTML string, or jQuery object.
Documentation and examples at [http://api.jquery.com/insertAfter/](http://api.jquery.com/insertAfter/).
## insert\_before
## filter
## first
## last
## parent
## prepend
## prepend\_to
## remove
## remove\_attr
## remove\_class
## replace\_with
## serialize
## size
## tagname
## text
## xfind
Like ["find"](#find), but uses a xpath expression instead of css selector.
## xfilter
Like ["filter"](#filter), but uses a xpath expression instead of css selector.
# LICENSE
Copyright (C) Carlos Fernando Avila Gratz.
This library is free software; you can redistribute it and/or modify
it under the same terms as Perl itself.# AUTHOR
Carlos Fernando Avila Gratz <[email protected]>