Skip to main content

Bug Tracker

Side navigation

Ticket #2147: testcase.html

File testcase.html, 2.0 KB (added by G_Gus, January 11, 2008 03:43PM UTC)

testcase and a semi-real case

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="">
<script src="" type="text/javascript">
<pre id="output">
Here's the XML:

		&lt;value&gt;Hi, I am a test sentence&lt;/value&gt;
		&lt;value&gt;Hi, I am the test explanation&lt;/value&gt;
		&lt;value&gt;Hi, I am a totally extraneus text&lt;/value&gt;
<script type="text/javascript">
	xml_test = '<translation>';
	xml_test += '<sentence><key>test<\/key><value>Hi, I am a test sentence<\/value><\/sentence>';
	xml_test += '<sentence><key>test_explanation<\/key><value>Hi, I am the test explanation<\/value><\/sentence>';
	xml_test += '<sentence><key>contestable<\/key><value>Hi, I am a totally extraneus text<\/value><\/sentence>';
	xml_test += '<\/translation>';
		'<br />jQuery string <b>' +   'sentence key:contains(test)' + '<\/b> returns ' +
		$('sentence key:contains(test)',xml_test).size()
		+ ' nodes'

	jQuery.extend(jQuery.expr[":"], {
	  equals: "(a.textContent||a.innerText||jQuery(a).text()||'')==m[3]"
	$('#output').append('<br /><br />Added new exact-match selector:<br />equals: "(a.textContent||a.innerText||jQuery(a).text()||\'\')==m[3]"<br />');
		'<br />jQuery string <b>' +   'sentence key:equals(test)' + '<\/b> returns ' +
		$('sentence key:equals(test)',xml_test).size()
		+ ' nodes<br />'

		'<br />jQuery string <b>' +   'sentence:has(key:equals(test))>value' + '<\/b> returns: ' +

Download in other formats:

Original Format