This repository is private.
All pages are served over SSL and all pushing and pulling is done over SSH.
No one may fork, clone, or view it unless they are added as a member.
Every repository with this icon (
) is private.
Every repository with this icon (
This repository is public.
Anyone may fork, clone, or view it.
Every repository with this icon (
) is public.
Every repository with this icon (
| name | age | message | |
|---|---|---|---|
| |
README.markdown | ||
| |
jquery-latest.js | ||
| |
qunit.html | ||
| |
testrunner.js | ||
| |
testsuite.css | ||
| |
url_pattern.js | ||
| |
url_pattern_test.js |
README.markdown
url_pattern.js
A Library for url pattern matches. Match patterns: http://dev.chromium.org/developers/design-documents/extensions/match-patterns
Example
Use single pattern.
URLPattern.matches('http://example.com/*',
'http://example.com/foo.html') // true
URLPattern.matches('http://example.com/bar*',
'http://example.com/foo.html') // false
URLPattern.matches('http://*.com/*',
'http://example.com/foo.html') // true
URLPattern.matches('http://*.com/*',
'http://example.org/foo.html') // false
URLPattern.matches('https://*.com/*',
'http://example.org/foo.html') //false
Use multiple patterns.
var scripts = [
{
name: 'foo',
matches: ['http://example.com/*']
},
{
name: 'bar',
matches: ['http://*/*', 'https://*/*']
},
{
name: 'baz',
matches: ['file:///*']
}
]
var up = new URLPattern(scripts.map(function(i) { return i.matches }))
var indexes = up.matches('http://example.com/foo.html')
indexes.map(function(i) { return scripts[i].name }) // [foo, bar]
Copyright
The MIT License Copyright (c) 2009 swdyh








