Skip to content

Commit c83985b

Browse files
author
Carlos Fernando Avila Gratz
committed
Checking in changes prior to tagging of version 0.01.
Changelog diff is: diff --git a/Changes b/Changes index 092109f..a0f372d 100644 --- a/Changes +++ b/Changes @@ -2,4 +2,7 @@ Revision history for Perl extension XML::LibXML::jQuery {{$NEXT}} - - original version +0.01 2016-06-22T18:46:06Z + + - initial import from cafe's private repo + - written basic pod
1 parent e0692ff commit c83985b

File tree

4 files changed

+167
-8
lines changed

4 files changed

+167
-8
lines changed

Changes

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,7 @@ Revision history for Perl extension XML::LibXML::jQuery
22

33
{{$NEXT}}
44

5-
- original version
5+
0.01 2016-06-22T18:46:06Z
6+
7+
- initial import from cafe's private repo
8+
- written basic pod

META.json

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"abstract" : "It's new $module",
2+
"abstract" : "Fast, jQuery-like DOM manipulation over XML::LibXML",
33
"author" : [
44
"Carlos Fernando Avila Gratz <cafe@kreato.com.br>"
55
],
@@ -12,7 +12,7 @@
1212
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
1313
"version" : "2"
1414
},
15-
"name" : "XML::LibXML::jQuery",
15+
"name" : "XML-LibXML-jQuery",
1616
"no_index" : {
1717
"directory" : [
1818
"t",
@@ -42,6 +42,9 @@
4242
},
4343
"runtime" : {
4444
"requires" : {
45+
"HTML::Selector::XPath" : "0",
46+
"JSON" : "2.90",
47+
"XML::LibXML" : "0",
4548
"perl" : "5.008001"
4649
}
4750
},
@@ -52,6 +55,17 @@
5255
}
5356
},
5457
"release_status" : "unstable",
58+
"resources" : {
59+
"bugtracker" : {
60+
"web" : "https://github.com/cafe01/xml-libxml-jquery/issues"
61+
},
62+
"homepage" : "https://github.com/cafe01/xml-libxml-jquery",
63+
"repository" : {
64+
"type" : "git",
65+
"url" : "git://github.com/cafe01/xml-libxml-jquery.git",
66+
"web" : "https://github.com/cafe01/xml-libxml-jquery"
67+
}
68+
},
5569
"version" : "0.01",
5670
"x_authority" : "cpan:CAFEGRATZ"
5771
}

README.md

Lines changed: 145 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,157 @@
1+
[![Build Status](https://travis-ci.org/cafe01/xml-libxml-jquery.svg?branch=master)](https://travis-ci.org/cafe01/xml-libxml-jquery)
12
# NAME
23

3-
XML::LibXML::jQuery - It's new $module
4+
XML::LibXML::jQuery - Fast, jQuery-like DOM manipulation over XML::LibXML
45

56
# SYNOPSIS
67

78
use XML::LibXML::jQuery;
89

10+
my $div = j(<<HTML);
11+
<div>
12+
<h1>Hello World</h1>
13+
<p> ... </p>
14+
<p> ... </p>
15+
</div>
16+
HTML
17+
18+
$div->find('h1')->text; # Hello World
19+
20+
$div->find('p')->size; # 2
21+
922
# DESCRIPTION
1023

11-
XML::LibXML::jQuery is ...
24+
XML::LibXML::jQuery is a jQuery-like DOM manipulation module build on top of
25+
[XML::LibXML](https://metacpan.org/pod/XML::LibXML) for speed. The goal is to be as fast as possible, and as compatible
26+
as possible with the javascript version of jQuery. Unlike similar modules,
27+
web fetching functionality like `-`append($url)> was intentionally not implemented.
28+
29+
# SIMILAR MODULES
30+
31+
Following is a list of similar CPAN modules.
32+
33+
- Web::Query::LibXML
34+
35+
[Web::Query::LibXML](https://metacpan.org/pod/Web::Query::LibXML) is my previous attempt to create a fast, jQuery-like module.
36+
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))
37+
for the underlying DOM system, its not as fast as if it used XML::LibXML directly.
38+
Also, maintaining it was a bit of a pain because of the API contracts to [Web::Query](https://metacpan.org/pod/Web::Query)
39+
and [HTML::TreeBuilder](https://metacpan.org/pod/HTML::TreeBuilder).
40+
41+
- jQuery
42+
43+
[jQuery](https://metacpan.org/pod/jQuery) seemed to be the perfect candidade for me to use/contribute since its
44+
a jQuery port implemented directly over XML::LibXML, but discarded the idea after
45+
finding some issues. It was slower than Web::Query::LibXML for some methods, it
46+
has its own css selector engine (whose code was a bit scary, I'd rather just
47+
use HTML::Selector::XPath), invalid html output (spits xml) and even some broken
48+
methods. Which obviously could be fixed, but honestly I didn't find its codebase
49+
fun to work on.
50+
51+
- Web::Query
52+
53+
[Web::Query](https://metacpan.org/pod/Web::Query) uses the pure perl DOM implementation [HTML::TreeBuilder](https://metacpan.org/pod/HTML::TreeBuilder), so its
54+
slow.
55+
56+
- pQuery
57+
58+
[pQuery](https://metacpan.org/pod/pQuery) is also built on top of [HTML::TreeBuilder](https://metacpan.org/pod/HTML::TreeBuilder), so..
59+
60+
# CONSTRUCTOR
61+
62+
## new
63+
64+
Parses a HTML source and returns a new [XML::LibXML::jQuery](https://metacpan.org/pod/XML::LibXML::jQuery) instance.
65+
66+
# EXPORTED FUNCTION
67+
68+
## j
69+
70+
A shortcut to [new](https://metacpan.org/pod/new).
71+
72+
# METHODS
73+
74+
Unless otherwise noted, all methods behave exactly like the javascript version.
75+
76+
## add
77+
78+
## add\_class
79+
80+
## after
81+
82+
## append
83+
84+
## append\_to
85+
86+
## as\_html
87+
88+
## attr
89+
90+
## before
91+
92+
## children
93+
94+
## clone
95+
96+
## contents
97+
98+
## data
99+
100+
## detach
101+
102+
## document
103+
104+
## each
105+
106+
## eq
107+
108+
## end
109+
110+
## find
111+
112+
## get
113+
114+
## html
115+
116+
## insert\_after
117+
118+
## insert\_before
119+
120+
## filter
121+
122+
## first
123+
124+
## last
125+
126+
## parent
127+
128+
## prepend
129+
130+
## prepend\_to
131+
132+
## remove
133+
134+
## remove\_attr
135+
136+
## remove\_class
137+
138+
## replace\_with
139+
140+
## serialize
141+
142+
## size
143+
144+
## tagname
145+
146+
## text
147+
148+
## xfind
149+
150+
Like ["find"](#find), but uses a xpath expression instead of css selector.
151+
152+
## xfilter
153+
154+
Like ["filter"](#filter), but uses a xpath expression instead of css selector.
12155

13156
# LICENSE
14157

minil.toml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
name = "XML::LibXML::jQuery"
2-
# badges = ["travis"]
1+
name = "XML-LibXML-jQuery"
2+
badges = ["travis"]
33
authority="cpan:CAFEGRATZ"
44

55
module_maker="ModuleBuildTiny"
6-

0 commit comments

Comments
 (0)