-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
165 lines (164 loc) · 7.77 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>$.string -- Prototype String functions for jQuery</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
jQuery.noConflict();
</script>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/prototype/1.6.0.3/prototype.js"></script>
<script type="text/javascript" src="jquery.string.1.1.0.js"></script>
<script type="text/javascript" src="jquery.string.testsuite.js"></script>
<script type="text/javascript">
</script>
<style type='text/css'>
body { background: #fff; }
div.text {
padding: 10pt;
background: #9ff;
}
div.code {
background: #ff9;
padding: 5pt 20pt;
margin: 10pt 0;
font-family: "Courier New", Courier, monospace;
}
#testresults {
font-family: "Courier New", Courier, monospace;
font-size: 11pt;
width: 500pt;
text-align: right;
padding: 10pt;
border: 1px dashed #900;
margin: 20pt 0;
}
#testresults span.test {
float: left;
}
.pass { color: blue; font-weight: bold; }
.fail { color: red; font-weight: bold; }
</style>
</head>
<body>
<h1><a name="top"></a>$.string -- Prototype String functions for jQuery</h1>
<div class="text">
<ul>
<li><a href="#about">About</a></li>
<li><a href="#usage">Usage</a></li>
<li><a href="#credits">Credits and License</a></li>
<li><a href="#download">Download</a></li>
<li><a href="#test">Test Results</a></li>
</ul>
</div>
<h2><a name="about"></a>About $.string</h2>
<div class="text">
<p>
<a href="http://www.jquery.com">jQuery</a> is a fantastic javascript library with excellent CSS selector capabilities and DOM manipulation. It's light-weight and really fast. Prototype is an excellent all-purpose library with many great utility features, including string manipulation, enumerable arrays and hashes. I love using <a href="http://www.jquery.com">jQuery</a> for its speed and simplicity, but I miss Prototype's utilities. Luckily, <a href="http://www.jquery.com">jQuery</a> is very extensible with its versatile plugin system. <em>$.string</em> is a plugin which aims to provide Prototype's string manipulation functions to <a href="http://www.jquery.com">jQuery</a>.
</p>
<p>
<em>$.string</em> requires jQuery 1.2.2 or later. It may work with earlier versions, but only these have been tested. <em>$.string</em> has been tested with the following web browsers:
</p>
<ul>
<li>Chrome 11+ (probably works with earlier versions)</li>
<li>Firefox 2.x, 3.x or 4.x</li>
<li>Internet Explorer 6, 7, 8 or 9</li>
<li>Opera 9.5</li>
<li>Safari 3.x, 4.x, and 5.x</li>
</ul>
<p><a href="#top">^ top</a></p>
</div>
<h2><a name="usage"></a>Usage</h2>
<div class="text">
Include jQuery and $.string in your header:
<div class="code">
<script type="text/javascript" src="jquery-latest.min.js"></script><br />
<script type="text/javascript" src="jquery.string.1.1.0.js"></script>
</div>
<em>$.string</em> methods are the same as their Prototype counterparts. Unlike Prototype, <em>$.string</em>
does <em>not</em> by default extend the String JavaScript prototype. You must create a $.string
object:
<div class="code">
$.string(" ").blank();<br />
<span class="pass">> true</span>
</div>
All methods that do not return a String will produce the same result as the Prototype counterpart.
<em>blank</em> returns boolean, <em>evalJSON</em> returns a JSON object, etc. For methods that
<em>do</em> return a string, $.string will return another $.string object. This allows you to
chain $.string methods without needing to extend String. You can retrieve the string portion
of the object using the '<span class="pass">str</span>' property.
<div class="code">
$.string(" <p>this is a test</p> ").strip().stripTags().capitalize().str<br />
<span class="pass">> 'This is a test'</span>
</div>
$.string can also be used to extend the String prototype in the same manner that Prototype does,
giving you the same functionality and compatibility.
<div class="code">
$.string(String.prototype);<br />
" <p>this is a test</p> ".strip().stripTags().capitalize()<br />
<span class="pass">> 'This is a test'</span>
</div>
<em>$.string</em>'s compatibility target is <em>Prototype 1.6.0.2</em>. Latest Prototype version is
<em>1.7.0.0</em>, however this introduced an incompatibility with the <em>toJSON</em> method, so
it was decided to maintain 1.6.0.3 compatibility as this is more of a legacy/transition project.
All other methods pass their compatibility tests in <em>1.7.0.0</em>.
<p><a href="#top">^ top</a></p>
</div>
<h2><a name="credits"></a>Credits and License</h2>
<div class="text">
<p>
<strong>COPYRIGHT</strong><br />
jquery.string - Prototype string functions for jQuery<br />
(c) 2008-2011 David E. Still (<a href="http://stilldesigning.com">http://stilldesigning.com</a>)<br />
Original Prototype extensions (c) 2005-2011 Sam Stephenson (<a href="http://prototypejs.org">http://prototypejs.org</a>)
</p>
<p>
<strong>LICENSE</strong><br />
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
</p>
<p>
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
</p>
<p>
(The astute reader will note that this is the same license that Prototype is released under.)
</p>
<p><a href="#top">^ top</a></p>
</div>
<h2><a name="download"></a>Download</h2>
<div class="text">
<p>
<a href="jquery.string.1.1.0.js">jquery.string.1.1.0.js</a> - $.string - uncompressed (14.2k)<br />
<a href="jquery.string.1.1.0-min.js">jquery.string.1.1.0-min.js</a> - $.string - minified (4.8k)<br />
<a href="jquery.string.testsuite.js">jquery.string.testsuite.js</a> - $.string Test Suite (16.8k)
</p>
<strong>$.string</strong> is also available through SVN on Google Code at
<a href="http://code.google.com/p/jquery-dotstring/">http://code.google.com/p/jquery-dotstring/</a>.
<p><a href="#top">^ top</a></p>
</div>
<h2><a name="test"></a>Test Results</h2>
<div class="text">
<p>
Below is the results of the compatibility test suite for <em>$.string</em>. A <span class="fail">Failed!</span> test
will also list the number of the test(s) that failed. If you find additional test cases that can
be added that cover conditions not adequately represented by the existing test suite, please contact
<span class="pass">dave <at> stilldesigning <dot> com</span>.
</p>
<p><a href="#top">^ top</a></p>
</div>
<div id="testresults"></div>
<div class="text">
<p><a href="#top">^ top</a></p>
</div>
</body>
</html>