Merge branch 'staging' of github.com:FreeCodeCamp/freecodecamp into staging
Conflicts: app.js controllers/fieldGuide.js controllers/story.js seed/challenges/basic-html5-and-css.json seed/challenges/bootstrap.json seed/field-guides.json server/views/partials/navbar.jade views/resources/jobs-form.jade views/resources/nonprofits-form.jade views/resources/pmi-acp-agile-project-managers-form.jade
This commit is contained in:
1
.eslintignore
Normal file
1
.eslintignore
Normal file
@ -0,0 +1 @@
|
||||
public/**/*.js
|
@ -15,7 +15,8 @@
|
||||
"window": true,
|
||||
"$": true,
|
||||
"ga": true,
|
||||
"jQuery": true
|
||||
"jQuery": true,
|
||||
"router": true
|
||||
},
|
||||
"rules": {
|
||||
"no-comma-dangle": 2,
|
||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -24,7 +24,5 @@ node_modules
|
||||
.DS_Store
|
||||
Thumbs.db
|
||||
bower_components
|
||||
.eslintignore
|
||||
.eslintrc
|
||||
main.css
|
||||
bundle.js
|
||||
|
2
Procfile
2
Procfile
@ -1 +1 @@
|
||||
web: ./node_modules/.bin/forever -m 5 app.js
|
||||
web: ./node_modules/.bin/forever -m 5 server.js
|
25
README.md
25
README.md
@ -65,25 +65,36 @@ Edit your .env file with the following API keys accordingly (if you only use ema
|
||||
```
|
||||
|
||||
MONGOHQ_URL='mongodb://localhost:27017/freecodecamp'
|
||||
BLOGGER_KEY=stuff
|
||||
|
||||
FACEBOOK_ID=stuff
|
||||
FACEBOOK_SECRET=stuff
|
||||
|
||||
GITHUB_ID=stuff
|
||||
GITHUB_SECRET=stuff
|
||||
|
||||
GOOGLE_ID=stuff
|
||||
GOOGLE_SECRET=stuff
|
||||
|
||||
LINKEDIN_ID=stuff
|
||||
LINKEDIN_SECRET=stuff
|
||||
|
||||
MANDRILL_PASSWORD=stuff
|
||||
MANDRILL_USER=stuff
|
||||
SESSION_SECRET=secretstuff
|
||||
|
||||
TRELLO_KEY=stuff
|
||||
TRELLO_SECRET=stuff
|
||||
|
||||
TWITTER_KEY=stuff
|
||||
TWITTER_SECRET=stuff
|
||||
TWITTER_TOKEN=stuff
|
||||
TWITTER_TOKEN_SECRET=stuff
|
||||
|
||||
BLOGGER_KEY=stuff
|
||||
SLACK_WEBHOOK=stuff
|
||||
|
||||
SESSION_SECRET=secretstuff
|
||||
COOKIE_SECRET='this is a secret'
|
||||
|
||||
PEER=stuff
|
||||
DEBUG=true
|
||||
|
||||
@ -95,7 +106,7 @@ DEBUG=true
|
||||
mongod
|
||||
|
||||
# Seed your database with the challenges
|
||||
node seed_data/seed.js
|
||||
node seed/
|
||||
|
||||
# start the application
|
||||
gulp
|
||||
@ -114,8 +125,8 @@ Project Structure
|
||||
| **controllers**/home.js | Controller for home page (index). |
|
||||
| **controllers**/user.js | Controller for user account management. |
|
||||
| **controllers**/challenges.js | Controller for rendering the challenges. |
|
||||
| **models**/User.js | Mongoose schema and model for User. |
|
||||
| **models**/Challenge.js | Mongoose schema and model for Challenge. |
|
||||
| **models**/user.json | Mongoose schema and model for User. |
|
||||
| **models**/challenge.json | Mongoose schema and model for Challenge. |
|
||||
| **public**/ | Static assets (fonts, css, js, img). |
|
||||
| **public**/**js**/application.js | Specify client-side JavaScript dependencies. |
|
||||
| **public**/**js**/main_0.0.2.js | Place your client-side JavaScript here. |
|
||||
@ -126,7 +137,7 @@ Project Structure
|
||||
| **views/partials**/footer.jade | Footer partial template. |
|
||||
| **views**/layout.jade | Base template. |
|
||||
| **views**/home.jade | Home page template. |
|
||||
| app.js | Main application file. |
|
||||
| server.js | Main application file. |
|
||||
|
||||
|
||||
List of Packages
|
||||
@ -155,7 +166,7 @@ List of Packages
|
||||
| github-api | GitHub API library. |
|
||||
| jade | Template engine for Express. |
|
||||
| less | LESS compiler. Used implicitly by connect-assets. |
|
||||
| helmet | Restricts Cross site requests. You can modify its settings in app.js |
|
||||
| helmet | Restricts Cross site requests. You can modify its settings in server.js |
|
||||
| mongoose | MongoDB ODM. |
|
||||
| nodemailer | Node.js library for sending emails. |
|
||||
| passport | Simple and elegant authentication library for node.js |
|
||||
|
682
app.js
682
app.js
@ -1,682 +0,0 @@
|
||||
require('dotenv').load();
|
||||
// handle uncaught exceptions. Forever will restart process on shutdown
|
||||
process.on('uncaughtException', function (err) {
|
||||
console.error(
|
||||
(new Date()).toUTCString() + ' uncaughtException:',
|
||||
err.message
|
||||
);
|
||||
console.error(err.stack);
|
||||
/* eslint-disable no-process-exit */
|
||||
process.exit(1);
|
||||
/* eslint-enable no-process-exit */
|
||||
});
|
||||
|
||||
var express = require('express'),
|
||||
hpp = require('hpp'),
|
||||
accepts = require('accepts'),
|
||||
cookieParser = require('cookie-parser'),
|
||||
compress = require('compression'),
|
||||
session = require('express-session'),
|
||||
logger = require('morgan'),
|
||||
errorHandler = require('errorhandler'),
|
||||
methodOverride = require('method-override'),
|
||||
bodyParser = require('body-parser'),
|
||||
helmet = require('helmet'),
|
||||
frameguard = require('frameguard'),
|
||||
csp = require('helmet-csp'),
|
||||
MongoStore = require('connect-mongo')(session),
|
||||
flash = require('express-flash'),
|
||||
path = require('path'),
|
||||
mongoose = require('mongoose'),
|
||||
passport = require('passport'),
|
||||
expressValidator = require('express-validator'),
|
||||
request = require('request'),
|
||||
forceDomain = require('forcedomain'),
|
||||
lessMiddleware = require('less-middleware'),
|
||||
|
||||
/**
|
||||
* Controllers (route handlers).
|
||||
*/
|
||||
homeController = require('./controllers/home'),
|
||||
resourcesController = require('./controllers/resources'),
|
||||
userController = require('./controllers/user'),
|
||||
nonprofitController = require('./controllers/nonprofits'),
|
||||
fieldGuideController = require('./controllers/fieldGuide'),
|
||||
challengeMapController = require('./controllers/challengeMap'),
|
||||
challengeController = require('./controllers/challenge'),
|
||||
jobsController = require('./controllers/jobs'),
|
||||
|
||||
/**
|
||||
* Stories
|
||||
*/
|
||||
storyController = require('./controllers/story'),
|
||||
|
||||
/**
|
||||
* API keys and Passport configuration.
|
||||
*/
|
||||
secrets = require('./config/secrets'),
|
||||
passportConf = require('./config/passport');
|
||||
|
||||
/**
|
||||
* Create Express server.
|
||||
*/
|
||||
var app = express();
|
||||
|
||||
/**
|
||||
* Connect to MongoDB.
|
||||
*/
|
||||
mongoose.connect(secrets.db);
|
||||
mongoose.connection.on('error', function () {
|
||||
console.error(
|
||||
'MongoDB Connection Error. Please make sure that MongoDB is running.'
|
||||
);
|
||||
});
|
||||
|
||||
/**
|
||||
* Express configuration.
|
||||
*/
|
||||
|
||||
|
||||
app.set('port', process.env.PORT || 3000);
|
||||
app.set('views', path.join(__dirname, 'views'));
|
||||
app.set('view engine', 'jade');
|
||||
|
||||
if (process.env.NODE_ENV === 'production') {
|
||||
app.use(forceDomain({
|
||||
hostname: 'www.freecodecamp.com'
|
||||
}));
|
||||
}
|
||||
app.use(hpp());
|
||||
app.use(compress());
|
||||
app.use(lessMiddleware(__dirname + '/public'));
|
||||
app.use(logger('dev'));
|
||||
app.use(bodyParser.json());
|
||||
app.use(bodyParser.urlencoded({extended: true}));
|
||||
app.use(expressValidator({
|
||||
customValidators: {
|
||||
matchRegex: function (param, regex) {
|
||||
return regex.test(param);
|
||||
}
|
||||
}
|
||||
}));
|
||||
app.use(methodOverride());
|
||||
app.use(cookieParser());
|
||||
app.use(session({
|
||||
resave: true,
|
||||
saveUninitialized: true,
|
||||
secret: secrets.sessionSecret,
|
||||
store: new MongoStore({
|
||||
url: secrets.db,
|
||||
'autoReconnect': true
|
||||
})
|
||||
}));
|
||||
app.use(passport.initialize());
|
||||
app.use(passport.session());
|
||||
app.use(flash());
|
||||
app.disable('x-powered-by');
|
||||
|
||||
app.use(helmet.xssFilter());
|
||||
app.use(helmet.noSniff());
|
||||
app.use(helmet.frameguard());
|
||||
app.use(function(req, res, next) {
|
||||
res.header('Access-Control-Allow-Origin', '*');
|
||||
res.header('Access-Control-Allow-Headers',
|
||||
'Origin, X-Requested-With, Content-Type, Accept'
|
||||
);
|
||||
next();
|
||||
});
|
||||
|
||||
var trusted = [
|
||||
"'self'",
|
||||
'blob:',
|
||||
'*.freecodecamp.com',
|
||||
'http://www.freecodecamp.com',
|
||||
'ws://freecodecamp.com/',
|
||||
'ws://www.freecodecamp.com/',
|
||||
'*.gstatic.com',
|
||||
'*.google-analytics.com',
|
||||
'*.googleapis.com',
|
||||
'*.google.com',
|
||||
'*.gstatic.com',
|
||||
'*.doubleclick.net',
|
||||
'*.twitter.com',
|
||||
'*.twitch.tv',
|
||||
'*.twimg.com',
|
||||
"'unsafe-eval'",
|
||||
"'unsafe-inline'",
|
||||
'*.bootstrapcdn.com',
|
||||
'*.cloudflare.com',
|
||||
'https://*.cloudflare.com',
|
||||
'localhost:3001',
|
||||
'ws://localhost:3001/',
|
||||
'http://localhost:3001',
|
||||
'localhost:3000',
|
||||
'ws://localhost:3000/',
|
||||
'http://localhost:3000',
|
||||
'*.ionicframework.com',
|
||||
'https://syndication.twitter.com',
|
||||
'*.youtube.com',
|
||||
'*.jsdelivr.net',
|
||||
'https://*.jsdelivr.net',
|
||||
'*.ytimg.com',
|
||||
'*.bitly.com',
|
||||
'http://cdn.inspectlet.com/',
|
||||
'wss://inspectletws.herokuapp.com/',
|
||||
'http://hn.inspectlet.com/'
|
||||
];
|
||||
|
||||
app.use(helmet.csp({
|
||||
defaultSrc: trusted,
|
||||
scriptSrc: [
|
||||
'*.optimizely.com',
|
||||
'*.aspnetcdn.com',
|
||||
'*.d3js.org'
|
||||
].concat(trusted),
|
||||
'connect-src': [
|
||||
].concat(trusted),
|
||||
styleSrc: trusted,
|
||||
imgSrc: [
|
||||
/* allow all input since we have user submitted images for public profile*/
|
||||
'*'
|
||||
].concat(trusted),
|
||||
fontSrc: ['*.googleapis.com'].concat(trusted),
|
||||
mediaSrc: [
|
||||
'*.amazonaws.com',
|
||||
'*.twitter.com'
|
||||
].concat(trusted),
|
||||
frameSrc: [
|
||||
|
||||
'*.gitter.im',
|
||||
'*.gitter.im https:',
|
||||
'*.vimeo.com',
|
||||
'*.twitter.com',
|
||||
'*.ghbtns.com'
|
||||
].concat(trusted),
|
||||
reportOnly: false, // set to true if you only want to report errors
|
||||
setAllHeaders: false, // set to true if you want to set all headers
|
||||
safari5: false // set to true if you want to force buggy CSP in Safari 5
|
||||
}));
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
// Make user object available in templates.
|
||||
res.locals.user = req.user;
|
||||
next();
|
||||
});
|
||||
|
||||
app.use(express.static(__dirname + '/public', {maxAge: 86400000 }));
|
||||
|
||||
app.use(function (req, res, next) {
|
||||
// Remember original destination before login.
|
||||
var path = req.path.split('/')[1];
|
||||
if (/auth|login|logout|signin|signup|fonts|favicon/i.test(path)) {
|
||||
return next();
|
||||
} else if (/\/stories\/comments\/\w+/i.test(req.path)) {
|
||||
return next();
|
||||
}
|
||||
req.session.returnTo = req.path;
|
||||
next();
|
||||
});
|
||||
|
||||
/**
|
||||
* Main routes.
|
||||
*/
|
||||
|
||||
app.get('/', homeController.index);
|
||||
|
||||
app.get('/nonprofit-project-instructions', function(req, res) {
|
||||
res.redirect(301, '/field-guide/how-do-free-code-camps-nonprofit-projects-work');
|
||||
});
|
||||
|
||||
app.post('/get-help', resourcesController.getHelp);
|
||||
|
||||
app.post('/get-pair', resourcesController.getPair);
|
||||
|
||||
app.get('/chat', resourcesController.chat);
|
||||
|
||||
app.get('/twitch', resourcesController.twitch);
|
||||
|
||||
app.get('/cats.json', function(req, res) {
|
||||
res.send(
|
||||
[
|
||||
{
|
||||
"name": "cute",
|
||||
"imageLink": "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcRaP1ecF2jerISkdhjr4R9yM9-8ClUy-TA36MnDiFBukd5IvEME0g"
|
||||
},
|
||||
{
|
||||
"name": "grumpy",
|
||||
"imageLink": "http://cdn.grumpycats.com/wp-content/uploads/2012/09/GC-Gravatar-copy.png"
|
||||
},
|
||||
{
|
||||
"name": "mischievous",
|
||||
"imageLink": "http://www.kittenspet.com/wp-content/uploads/2012/08/cat_with_funny_face_3-200x200.jpg"
|
||||
}
|
||||
]
|
||||
)
|
||||
});
|
||||
|
||||
// Agile Project Manager Onboarding
|
||||
|
||||
app.get('/pmi-acp-agile-project-managers',
|
||||
resourcesController.agileProjectManagers);
|
||||
|
||||
app.get('/agile', function(req, res) {
|
||||
res.redirect(301, '/pmi-acp-agile-project-managers');
|
||||
});
|
||||
|
||||
app.get('/pmi-acp-agile-project-managers-form',
|
||||
resourcesController.agileProjectManagersForm);
|
||||
|
||||
// Nonprofit Onboarding
|
||||
|
||||
app.get('/nonprofits', resourcesController.nonprofits);
|
||||
|
||||
app.get('/nonprofits-form', resourcesController.nonprofitsForm);
|
||||
|
||||
app.get('/map',
|
||||
userController.userMigration,
|
||||
challengeMapController.challengeMap
|
||||
);
|
||||
|
||||
app.get('/live-pair-programming', function(req, res) {
|
||||
res.redirect(301, '/twitch');
|
||||
});
|
||||
|
||||
app.get('/learn-to-code', challengeMapController.challengeMap);
|
||||
app.get('/about', function(req, res) {
|
||||
res.redirect(301, '/map');
|
||||
});
|
||||
app.get('/signin', userController.getSignin);
|
||||
|
||||
app.get('/login', function(req, res) {
|
||||
res.redirect(301, '/signin');
|
||||
});
|
||||
|
||||
app.post('/signin', userController.postSignin);
|
||||
|
||||
app.get('/signout', userController.signout);
|
||||
|
||||
app.get('/logout', function(req, res) {
|
||||
res.redirect(301, '/signout');
|
||||
});
|
||||
|
||||
app.get('/forgot', userController.getForgot);
|
||||
|
||||
app.post('/forgot', userController.postForgot);
|
||||
|
||||
app.get('/reset/:token', userController.getReset);
|
||||
|
||||
app.post('/reset/:token', userController.postReset);
|
||||
|
||||
app.get('/email-signup', userController.getEmailSignup);
|
||||
|
||||
app.get('/email-signin', userController.getEmailSignin);
|
||||
|
||||
app.post('/email-signup', userController.postEmailSignup);
|
||||
|
||||
app.post('/email-signin', userController.postSignin);
|
||||
|
||||
/**
|
||||
* Nonprofit Project routes.
|
||||
*/
|
||||
|
||||
app.get('/nonprofits/directory', nonprofitController.nonprofitsDirectory);
|
||||
|
||||
app.get(
|
||||
'/nonprofits/:nonprofitName',
|
||||
nonprofitController.returnIndividualNonprofit
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/jobs',
|
||||
jobsController.jobsDirectory
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/jobs-form',
|
||||
resourcesController.jobsForm
|
||||
);
|
||||
|
||||
app.get('/privacy', function(req, res) {
|
||||
res.redirect(301, '/field-guide/what-is-the-free-code-camp-privacy-policy');
|
||||
});
|
||||
|
||||
app.get('/submit-cat-photo', resourcesController.catPhotoSubmit);
|
||||
|
||||
app.get('/api/slack', function(req, res) {
|
||||
if (req.user) {
|
||||
if (req.user.email) {
|
||||
var invite = {
|
||||
'email': req.user.email,
|
||||
'token': process.env.SLACK_KEY,
|
||||
'set_active': true
|
||||
};
|
||||
|
||||
var headers = {
|
||||
'User-Agent': 'Node Browser/0.0.1',
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
};
|
||||
|
||||
var options = {
|
||||
url: 'https://freecodecamp.slack.com/api/users.admin.invite',
|
||||
method: 'POST',
|
||||
headers: headers,
|
||||
form: invite
|
||||
};
|
||||
|
||||
request(options, function (error, response, body) {
|
||||
if (!error && response.statusCode === 200) {
|
||||
req.flash('success', {
|
||||
msg: "We've successfully requested an invite for you. Please check your email and follow the instructions from Slack."
|
||||
});
|
||||
req.user.sentSlackInvite = true;
|
||||
req.user.save(function(err, user) {
|
||||
if (err) {
|
||||
next(err);
|
||||
}
|
||||
return res.redirect('back');
|
||||
});
|
||||
} else {
|
||||
req.flash('errors', {
|
||||
msg: "The invitation email did not go through for some reason. Please try again or <a href='mailto:team@freecodecamp.com?subject=slack%20invite%20failed%20to%20send>email us</a>."
|
||||
});
|
||||
return res.redirect('back');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
req.flash('notice', {
|
||||
msg: "Before we can send your Slack invite, we need your email address. Please update your profile information here."
|
||||
});
|
||||
return res.redirect('/account');
|
||||
}
|
||||
} else {
|
||||
req.flash('notice', {
|
||||
msg: "You need to sign in to Free Code Camp before we can send you a Slack invite."
|
||||
});
|
||||
return res.redirect('/account');
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Camper News routes.
|
||||
*/
|
||||
app.get(
|
||||
'/stories/hotStories',
|
||||
storyController.hotJSON
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/stories/recentStories',
|
||||
storyController.recentJSON
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/stories/comments/:id',
|
||||
storyController.comments
|
||||
);
|
||||
|
||||
app.post(
|
||||
'/stories/comment/',
|
||||
storyController.commentSubmit
|
||||
);
|
||||
|
||||
app.post(
|
||||
'/stories/comment/:id/comment',
|
||||
storyController.commentOnCommentSubmit
|
||||
);
|
||||
|
||||
app.put(
|
||||
'/stories/comment/:id/edit',
|
||||
storyController.commentEdit
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/stories/submit',
|
||||
storyController.submitNew
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/stories/submit/new-story',
|
||||
storyController.preSubmit
|
||||
);
|
||||
|
||||
app.post(
|
||||
'/stories/preliminary',
|
||||
storyController.newStory
|
||||
);
|
||||
|
||||
app.post(
|
||||
'/stories/',
|
||||
storyController.storySubmission
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/news/',
|
||||
storyController.hot
|
||||
);
|
||||
|
||||
app.post(
|
||||
'/stories/search',
|
||||
storyController.getStories
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/news/:storyName',
|
||||
storyController.returnIndividualStory
|
||||
);
|
||||
|
||||
app.post(
|
||||
'/stories/upvote/',
|
||||
storyController.upvote
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/unsubscribe/:email',
|
||||
resourcesController.unsubscribe
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/unsubscribed',
|
||||
resourcesController.unsubscribed
|
||||
);
|
||||
|
||||
app.all('/account', passportConf.isAuthenticated);
|
||||
|
||||
app.get('/account/api', userController.getAccountAngular);
|
||||
|
||||
/**
|
||||
* API routes
|
||||
*/
|
||||
|
||||
app.get('/api/github', resourcesController.githubCalls);
|
||||
|
||||
app.get('/api/blogger', resourcesController.bloggerCalls);
|
||||
|
||||
app.get('/api/trello', resourcesController.trelloCalls);
|
||||
|
||||
app.get('/api/codepen/twitter/:screenName', resourcesController.codepenResources.twitter);
|
||||
|
||||
/**
|
||||
* Field Guide related routes
|
||||
*/
|
||||
app.get('/field-guide/all-articles', fieldGuideController.showAllFieldGuides);
|
||||
|
||||
app.get('/field-guide/:fieldGuideName',
|
||||
fieldGuideController.returnIndividualFieldGuide
|
||||
);
|
||||
|
||||
app.get('/field-guide/', fieldGuideController.returnNextFieldGuide);
|
||||
|
||||
app.post('/completed-field-guide/', fieldGuideController.completedFieldGuide);
|
||||
|
||||
|
||||
/**
|
||||
* Challenge related routes
|
||||
*/
|
||||
|
||||
app.get('/challenges/next-challenge',
|
||||
userController.userMigration,
|
||||
challengeController.returnNextChallenge
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/challenges/:challengeName',
|
||||
userController.userMigration,
|
||||
challengeController.returnIndividualChallenge
|
||||
);
|
||||
|
||||
app.get('/challenges/',
|
||||
userController.userMigration,
|
||||
challengeController.returnCurrentChallenge);
|
||||
// todo refactor these routes
|
||||
app.post('/completed-challenge/', challengeController.completedChallenge);
|
||||
|
||||
app.post('/completed-zipline-or-basejump',
|
||||
challengeController.completedZiplineOrBasejump);
|
||||
|
||||
app.post('/completed-bonfire', challengeController.completedBonfire);
|
||||
|
||||
// Unique Check API route
|
||||
app.get('/api/checkUniqueUsername/:username',
|
||||
userController.checkUniqueUsername
|
||||
);
|
||||
|
||||
app.get('/api/checkExistingUsername/:username',
|
||||
userController.checkExistingUsername
|
||||
);
|
||||
|
||||
app.get('/api/checkUniqueEmail/:email', userController.checkUniqueEmail);
|
||||
|
||||
app.get('/account', userController.getAccount);
|
||||
|
||||
app.post('/account/profile', userController.postUpdateProfile);
|
||||
|
||||
app.post('/account/password', userController.postUpdatePassword);
|
||||
|
||||
app.post('/account/delete', userController.postDeleteAccount);
|
||||
|
||||
app.get('/account/unlink/:provider', userController.getOauthUnlink);
|
||||
|
||||
app.get('/sitemap.xml', resourcesController.sitemap);
|
||||
|
||||
/**
|
||||
* OAuth sign-in routes.
|
||||
*/
|
||||
|
||||
var passportOptions = {
|
||||
successRedirect: '/',
|
||||
failureRedirect: '/login'
|
||||
};
|
||||
|
||||
app.get('/auth/twitter', passport.authenticate('twitter'));
|
||||
|
||||
app.get(
|
||||
'/auth/twitter/callback',
|
||||
passport.authenticate('twitter', {
|
||||
successRedirect: '/',
|
||||
failureRedirect: '/login'
|
||||
})
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/auth/linkedin',
|
||||
passport.authenticate('linkedin', {
|
||||
state: 'SOME STATE'
|
||||
})
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/auth/linkedin/callback',
|
||||
passport.authenticate('linkedin', passportOptions)
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/auth/facebook',
|
||||
passport.authenticate('facebook', {scope: ['email', 'user_location']})
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/auth/facebook/callback',
|
||||
passport.authenticate('facebook', passportOptions), function (req, res) {
|
||||
res.redirect(req.session.returnTo || '/');
|
||||
}
|
||||
);
|
||||
|
||||
app.get('/auth/github', passport.authenticate('github'));
|
||||
|
||||
app.get(
|
||||
'/auth/github/callback',
|
||||
passport.authenticate('github', passportOptions), function (req, res) {
|
||||
res.redirect(req.session.returnTo || '/');
|
||||
}
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/auth/google',
|
||||
passport.authenticate('google', {scope: 'profile email'})
|
||||
);
|
||||
|
||||
app.get(
|
||||
'/auth/google/callback',
|
||||
passport.authenticate('google', passportOptions), function (req, res) {
|
||||
res.redirect(req.session.returnTo || '/');
|
||||
}
|
||||
);
|
||||
|
||||
// put this route last
|
||||
app.get(
|
||||
'/:username',
|
||||
userController.returnUser
|
||||
);
|
||||
|
||||
/**
|
||||
* 500 Error Handler.
|
||||
*/
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
app.use(errorHandler({ log: true }));
|
||||
} else {
|
||||
// error handling in production
|
||||
app.use(function(err, req, res, next) {
|
||||
|
||||
// respect err.status
|
||||
if (err.status) {
|
||||
res.statusCode = err.status;
|
||||
}
|
||||
|
||||
// default status code to 500
|
||||
if (res.statusCode < 400) {
|
||||
res.statusCode = 500;
|
||||
}
|
||||
|
||||
// parse res type
|
||||
var accept = accepts(req);
|
||||
var type = accept.type('html', 'json', 'text');
|
||||
|
||||
var message = 'opps! Something went wrong. Please try again later';
|
||||
if (type === 'html') {
|
||||
req.flash('errors', { msg: message });
|
||||
return res.redirect('/');
|
||||
// json
|
||||
} else if (type === 'json') {
|
||||
res.setHeader('Content-Type', 'application/json');
|
||||
return res.send({ message: message });
|
||||
// plain text
|
||||
} else {
|
||||
res.setHeader('Content-Type', 'text/plain');
|
||||
return res.send(message);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Start Express server.
|
||||
*/
|
||||
|
||||
app.listen(app.get('port'), function () {
|
||||
console.log(
|
||||
'FreeCodeCamp server listening on port %d in %s mode',
|
||||
app.get('port'),
|
||||
app.get('env')
|
||||
);
|
||||
});
|
||||
|
||||
module.exports = app;
|
30
bower_components/angular-bootstrap/.bower.json
vendored
30
bower_components/angular-bootstrap/.bower.json
vendored
@ -1,30 +0,0 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "https://github.com/angular-ui/bootstrap/graphs/contributors"
|
||||
},
|
||||
"name": "angular-bootstrap",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"angular-ui",
|
||||
"bootstrap"
|
||||
],
|
||||
"description": "Native AngularJS (Angular) directives for Bootstrap.",
|
||||
"version": "0.12.0",
|
||||
"main": [
|
||||
"./ui-bootstrap-tpls.js"
|
||||
],
|
||||
"dependencies": {
|
||||
"angular": ">=1 <1.3.0"
|
||||
},
|
||||
"homepage": "https://github.com/angular-ui/bootstrap-bower",
|
||||
"_release": "0.12.0",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.12.0",
|
||||
"commit": "b7a256c24b4545e633920ca9a9545b35ed425412"
|
||||
},
|
||||
"_source": "git://github.com/angular-ui/bootstrap-bower.git",
|
||||
"_target": "~0.12.0",
|
||||
"_originalSource": "angular-bootstrap",
|
||||
"_direct": true
|
||||
}
|
17
bower_components/angular-bootstrap/bower.json
vendored
17
bower_components/angular-bootstrap/bower.json
vendored
@ -1,17 +0,0 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "https://github.com/angular-ui/bootstrap/graphs/contributors"
|
||||
},
|
||||
"name": "angular-bootstrap",
|
||||
"keywords": [
|
||||
"angular",
|
||||
"angular-ui",
|
||||
"bootstrap"
|
||||
],
|
||||
"description": "Native AngularJS (Angular) directives for Bootstrap.",
|
||||
"version": "0.12.0",
|
||||
"main": ["./ui-bootstrap-tpls.js"],
|
||||
"dependencies": {
|
||||
"angular": ">=1 <1.3.0"
|
||||
}
|
||||
}
|
4212
bower_components/angular-bootstrap/ui-bootstrap-tpls.js
vendored
4212
bower_components/angular-bootstrap/ui-bootstrap-tpls.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
3901
bower_components/angular-bootstrap/ui-bootstrap.js
vendored
3901
bower_components/angular-bootstrap/ui-bootstrap.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
17
bower_components/angular/.bower.json
vendored
17
bower_components/angular/.bower.json
vendored
@ -1,17 +0,0 @@
|
||||
{
|
||||
"name": "angular",
|
||||
"version": "1.2.28",
|
||||
"main": "./angular.js",
|
||||
"ignore": [],
|
||||
"dependencies": {},
|
||||
"homepage": "https://github.com/angular/bower-angular",
|
||||
"_release": "1.2.28",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.2.28",
|
||||
"commit": "d1369fe05d3a7d85961a2223292b67ee82b9f80a"
|
||||
},
|
||||
"_source": "git://github.com/angular/bower-angular.git",
|
||||
"_target": ">=1 <1.3.0",
|
||||
"_originalSource": "angular"
|
||||
}
|
67
bower_components/angular/README.md
vendored
67
bower_components/angular/README.md
vendored
@ -1,67 +0,0 @@
|
||||
# packaged angular
|
||||
|
||||
This repo is for distribution on `npm` and `bower`. The source for this module is in the
|
||||
[main AngularJS repo](https://github.com/angular/angular.js).
|
||||
Please file issues and pull requests against that repo.
|
||||
|
||||
## Install
|
||||
|
||||
You can install this package either with `npm` or with `bower`.
|
||||
|
||||
### npm
|
||||
|
||||
```shell
|
||||
npm install angular
|
||||
```
|
||||
|
||||
Then add a `<script>` to your `index.html`:
|
||||
|
||||
```html
|
||||
<script src="/node_modules/angular/angular.js"></script>
|
||||
```
|
||||
|
||||
Note that this package is not in CommonJS format, so doing `require('angular')` will return `undefined`.
|
||||
If you're using [Browserify](https://github.com/substack/node-browserify), you can use
|
||||
[exposify](https://github.com/thlorenz/exposify) to have `require('angular')` return the `angular`
|
||||
global.
|
||||
|
||||
### bower
|
||||
|
||||
```shell
|
||||
bower install angular
|
||||
```
|
||||
|
||||
Then add a `<script>` to your `index.html`:
|
||||
|
||||
```html
|
||||
<script src="/bower_components/angular/angular.js"></script>
|
||||
```
|
||||
|
||||
## Documentation
|
||||
|
||||
Documentation is available on the
|
||||
[AngularJS docs site](http://docs.angularjs.org/).
|
||||
|
||||
## License
|
||||
|
||||
The MIT License
|
||||
|
||||
Copyright (c) 2010-2012 Google, Inc. http://angularjs.org
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
24
bower_components/angular/angular-csp.css
vendored
24
bower_components/angular/angular-csp.css
vendored
@ -1,24 +0,0 @@
|
||||
/* Include this file in your html if you are using the CSP mode. */
|
||||
|
||||
@charset "UTF-8";
|
||||
|
||||
[ng\:cloak], [ng-cloak], [data-ng-cloak], [x-ng-cloak],
|
||||
.ng-cloak, .x-ng-cloak,
|
||||
.ng-hide {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
ng\:form {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.ng-animate-block-transitions {
|
||||
transition:0s all!important;
|
||||
-webkit-transition:0s all!important;
|
||||
}
|
||||
|
||||
/* show the element during a show/hide animation when the
|
||||
* animation is ongoing, but the .ng-hide class is active */
|
||||
.ng-hide-add-active, .ng-hide-remove {
|
||||
display: block!important;
|
||||
}
|
22154
bower_components/angular/angular.js
vendored
22154
bower_components/angular/angular.js
vendored
File diff suppressed because it is too large
Load Diff
217
bower_components/angular/angular.min.js
vendored
217
bower_components/angular/angular.min.js
vendored
@ -1,217 +0,0 @@
|
||||
/*
|
||||
AngularJS v1.2.28
|
||||
(c) 2010-2014 Google, Inc. http://angularjs.org
|
||||
License: MIT
|
||||
*/
|
||||
(function(W,X,u){'use strict';function z(b){return function(){var a=arguments[0],c,a="["+(b?b+":":"")+a+"] http://errors.angularjs.org/1.2.28/"+(b?b+"/":"")+a;for(c=1;c<arguments.length;c++)a=a+(1==c?"?":"&")+"p"+(c-1)+"="+encodeURIComponent("function"==typeof arguments[c]?arguments[c].toString().replace(/ \{[\s\S]*$/,""):"undefined"==typeof arguments[c]?"undefined":"string"!=typeof arguments[c]?JSON.stringify(arguments[c]):arguments[c]);return Error(a)}}function Sa(b){if(null==b||Ja(b))return!1;
|
||||
var a=b.length;return 1===b.nodeType&&a?!0:G(b)||L(b)||0===a||"number"===typeof a&&0<a&&a-1 in b}function r(b,a,c){var d;if(b)if(N(b))for(d in b)"prototype"==d||("length"==d||"name"==d||b.hasOwnProperty&&!b.hasOwnProperty(d))||a.call(c,b[d],d);else if(L(b)||Sa(b))for(d=0;d<b.length;d++)a.call(c,b[d],d);else if(b.forEach&&b.forEach!==r)b.forEach(a,c);else for(d in b)b.hasOwnProperty(d)&&a.call(c,b[d],d);return b}function Xb(b){var a=[],c;for(c in b)b.hasOwnProperty(c)&&a.push(c);return a.sort()}function Sc(b,
|
||||
a,c){for(var d=Xb(b),e=0;e<d.length;e++)a.call(c,b[d[e]],d[e]);return d}function Yb(b){return function(a,c){b(c,a)}}function ib(){for(var b=na.length,a;b;){b--;a=na[b].charCodeAt(0);if(57==a)return na[b]="A",na.join("");if(90==a)na[b]="0";else return na[b]=String.fromCharCode(a+1),na.join("")}na.unshift("0");return na.join("")}function Zb(b,a){a?b.$$hashKey=a:delete b.$$hashKey}function E(b){var a=b.$$hashKey;r(arguments,function(a){a!==b&&r(a,function(a,c){b[c]=a})});Zb(b,a);return b}function U(b){return parseInt(b,
|
||||
10)}function $b(b,a){return E(new (E(function(){},{prototype:b})),a)}function v(){}function ga(b){return b}function aa(b){return function(){return b}}function F(b){return"undefined"===typeof b}function D(b){return"undefined"!==typeof b}function T(b){return null!=b&&"object"===typeof b}function G(b){return"string"===typeof b}function jb(b){return"number"===typeof b}function va(b){return"[object Date]"===Ba.call(b)}function N(b){return"function"===typeof b}function kb(b){return"[object RegExp]"===Ba.call(b)}
|
||||
function Ja(b){return b&&b.document&&b.location&&b.alert&&b.setInterval}function Tc(b){return!(!b||!(b.nodeName||b.prop&&b.attr&&b.find))}function Uc(b,a,c){var d=[];r(b,function(b,f,g){d.push(a.call(c,b,f,g))});return d}function Ta(b,a){if(b.indexOf)return b.indexOf(a);for(var c=0;c<b.length;c++)if(a===b[c])return c;return-1}function Ua(b,a){var c=Ta(b,a);0<=c&&b.splice(c,1);return a}function Ka(b,a,c,d){if(Ja(b)||b&&b.$evalAsync&&b.$watch)throw Va("cpws");if(a){if(b===a)throw Va("cpi");c=c||[];
|
||||
d=d||[];if(T(b)){var e=Ta(c,b);if(-1!==e)return d[e];c.push(b);d.push(a)}if(L(b))for(var f=a.length=0;f<b.length;f++)e=Ka(b[f],null,c,d),T(b[f])&&(c.push(b[f]),d.push(e)),a.push(e);else{var g=a.$$hashKey;L(a)?a.length=0:r(a,function(b,c){delete a[c]});for(f in b)e=Ka(b[f],null,c,d),T(b[f])&&(c.push(b[f]),d.push(e)),a[f]=e;Zb(a,g)}}else if(a=b)L(b)?a=Ka(b,[],c,d):va(b)?a=new Date(b.getTime()):kb(b)?(a=RegExp(b.source,b.toString().match(/[^\/]*$/)[0]),a.lastIndex=b.lastIndex):T(b)&&(a=Ka(b,{},c,d));
|
||||
return a}function ha(b,a){if(L(b)){a=a||[];for(var c=0;c<b.length;c++)a[c]=b[c]}else if(T(b))for(c in a=a||{},b)!lb.call(b,c)||"$"===c.charAt(0)&&"$"===c.charAt(1)||(a[c]=b[c]);return a||b}function Ca(b,a){if(b===a)return!0;if(null===b||null===a)return!1;if(b!==b&&a!==a)return!0;var c=typeof b,d;if(c==typeof a&&"object"==c)if(L(b)){if(!L(a))return!1;if((c=b.length)==a.length){for(d=0;d<c;d++)if(!Ca(b[d],a[d]))return!1;return!0}}else{if(va(b))return va(a)?isNaN(b.getTime())&&isNaN(a.getTime())||b.getTime()===
|
||||
a.getTime():!1;if(kb(b)&&kb(a))return b.toString()==a.toString();if(b&&b.$evalAsync&&b.$watch||a&&a.$evalAsync&&a.$watch||Ja(b)||Ja(a)||L(a))return!1;c={};for(d in b)if("$"!==d.charAt(0)&&!N(b[d])){if(!Ca(b[d],a[d]))return!1;c[d]=!0}for(d in a)if(!c.hasOwnProperty(d)&&"$"!==d.charAt(0)&&a[d]!==u&&!N(a[d]))return!1;return!0}return!1}function Bb(b,a){var c=2<arguments.length?wa.call(arguments,2):[];return!N(a)||a instanceof RegExp?a:c.length?function(){return arguments.length?a.apply(b,c.concat(wa.call(arguments,
|
||||
0))):a.apply(b,c)}:function(){return arguments.length?a.apply(b,arguments):a.call(b)}}function Vc(b,a){var c=a;"string"===typeof b&&"$"===b.charAt(0)?c=u:Ja(a)?c="$WINDOW":a&&X===a?c="$DOCUMENT":a&&(a.$evalAsync&&a.$watch)&&(c="$SCOPE");return c}function oa(b,a){return"undefined"===typeof b?u:JSON.stringify(b,Vc,a?" ":null)}function ac(b){return G(b)?JSON.parse(b):b}function Wa(b){"function"===typeof b?b=!0:b&&0!==b.length?(b=x(""+b),b=!("f"==b||"0"==b||"false"==b||"no"==b||"n"==b||"[]"==b)):b=!1;
|
||||
return b}function ia(b){b=A(b).clone();try{b.empty()}catch(a){}var c=A("<div>").append(b).html();try{return 3===b[0].nodeType?x(c):c.match(/^(<[^>]+>)/)[1].replace(/^<([\w\-]+)/,function(a,b){return"<"+x(b)})}catch(d){return x(c)}}function bc(b){try{return decodeURIComponent(b)}catch(a){}}function cc(b){var a={},c,d;r((b||"").split("&"),function(b){b&&(c=b.replace(/\+/g,"%20").split("="),d=bc(c[0]),D(d)&&(b=D(c[1])?bc(c[1]):!0,lb.call(a,d)?L(a[d])?a[d].push(b):a[d]=[a[d],b]:a[d]=b))});return a}function Cb(b){var a=
|
||||
[];r(b,function(b,d){L(b)?r(b,function(b){a.push(Da(d,!0)+(!0===b?"":"="+Da(b,!0)))}):a.push(Da(d,!0)+(!0===b?"":"="+Da(b,!0)))});return a.length?a.join("&"):""}function mb(b){return Da(b,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Da(b,a){return encodeURIComponent(b).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,a?"%20":"+")}function Wc(b,a){function c(a){a&&d.push(a)}var d=[b],e,f,g=["ng:app","ng-app","x-ng-app",
|
||||
"data-ng-app"],h=/\sng[:\-]app(:\s*([\w\d_]+);?)?\s/;r(g,function(a){g[a]=!0;c(X.getElementById(a));a=a.replace(":","\\:");b.querySelectorAll&&(r(b.querySelectorAll("."+a),c),r(b.querySelectorAll("."+a+"\\:"),c),r(b.querySelectorAll("["+a+"]"),c))});r(d,function(a){if(!e){var b=h.exec(" "+a.className+" ");b?(e=a,f=(b[2]||"").replace(/\s+/g,",")):r(a.attributes,function(b){!e&&g[b.name]&&(e=a,f=b.value)})}});e&&a(e,f?[f]:[])}function dc(b,a){var c=function(){b=A(b);if(b.injector()){var c=b[0]===X?
|
||||
"document":ia(b);throw Va("btstrpd",c.replace(/</,"<").replace(/>/,">"));}a=a||[];a.unshift(["$provide",function(a){a.value("$rootElement",b)}]);a.unshift("ng");c=ec(a);c.invoke(["$rootScope","$rootElement","$compile","$injector","$animate",function(a,b,c,d,e){a.$apply(function(){b.data("$injector",d);c(b)(a)})}]);return c},d=/^NG_DEFER_BOOTSTRAP!/;if(W&&!d.test(W.name))return c();W.name=W.name.replace(d,"");Xa.resumeBootstrap=function(b){r(b,function(b){a.push(b)});c()}}function nb(b,a){a=
|
||||
a||"_";return b.replace(Xc,function(b,d){return(d?a:"")+b.toLowerCase()})}function Db(b,a,c){if(!b)throw Va("areq",a||"?",c||"required");return b}function Ya(b,a,c){c&&L(b)&&(b=b[b.length-1]);Db(N(b),a,"not a function, got "+(b&&"object"===typeof b?b.constructor.name||"Object":typeof b));return b}function Ea(b,a){if("hasOwnProperty"===b)throw Va("badname",a);}function fc(b,a,c){if(!a)return b;a=a.split(".");for(var d,e=b,f=a.length,g=0;g<f;g++)d=a[g],b&&(b=(e=b)[d]);return!c&&N(b)?Bb(e,b):b}function Eb(b){var a=
|
||||
b[0];b=b[b.length-1];if(a===b)return A(a);var c=[a];do{a=a.nextSibling;if(!a)break;c.push(a)}while(a!==b);return A(c)}function Yc(b){var a=z("$injector"),c=z("ng");b=b.angular||(b.angular={});b.$$minErr=b.$$minErr||z;return b.module||(b.module=function(){var b={};return function(e,f,g){if("hasOwnProperty"===e)throw c("badname","module");f&&b.hasOwnProperty(e)&&(b[e]=null);return b[e]||(b[e]=function(){function b(a,d,e){return function(){c[e||"push"]([a,d,arguments]);return n}}if(!f)throw a("nomod",
|
||||
e);var c=[],d=[],l=b("$injector","invoke"),n={_invokeQueue:c,_runBlocks:d,requires:f,name:e,provider:b("$provide","provider"),factory:b("$provide","factory"),service:b("$provide","service"),value:b("$provide","value"),constant:b("$provide","constant","unshift"),animation:b("$animateProvider","register"),filter:b("$filterProvider","register"),controller:b("$controllerProvider","register"),directive:b("$compileProvider","directive"),config:l,run:function(a){d.push(a);return this}};g&&l(g);return n}())}}())}
|
||||
function Zc(b){E(b,{bootstrap:dc,copy:Ka,extend:E,equals:Ca,element:A,forEach:r,injector:ec,noop:v,bind:Bb,toJson:oa,fromJson:ac,identity:ga,isUndefined:F,isDefined:D,isString:G,isFunction:N,isObject:T,isNumber:jb,isElement:Tc,isArray:L,version:$c,isDate:va,lowercase:x,uppercase:La,callbacks:{counter:0},$$minErr:z,$$csp:Za});$a=Yc(W);try{$a("ngLocale")}catch(a){$a("ngLocale",[]).provider("$locale",ad)}$a("ng",["ngLocale"],["$provide",function(a){a.provider({$$sanitizeUri:bd});a.provider("$compile",
|
||||
gc).directive({a:cd,input:hc,textarea:hc,form:dd,script:ed,select:fd,style:gd,option:hd,ngBind:id,ngBindHtml:jd,ngBindTemplate:kd,ngClass:ld,ngClassEven:md,ngClassOdd:nd,ngCloak:od,ngController:pd,ngForm:qd,ngHide:rd,ngIf:sd,ngInclude:td,ngInit:ud,ngNonBindable:vd,ngPluralize:wd,ngRepeat:xd,ngShow:yd,ngStyle:zd,ngSwitch:Ad,ngSwitchWhen:Bd,ngSwitchDefault:Cd,ngOptions:Dd,ngTransclude:Ed,ngModel:Fd,ngList:Gd,ngChange:Hd,required:ic,ngRequired:ic,ngValue:Id}).directive({ngInclude:Jd}).directive(Fb).directive(jc);
|
||||
a.provider({$anchorScroll:Kd,$animate:Ld,$browser:Md,$cacheFactory:Nd,$controller:Od,$document:Pd,$exceptionHandler:Qd,$filter:kc,$interpolate:Rd,$interval:Sd,$http:Td,$httpBackend:Ud,$location:Vd,$log:Wd,$parse:Xd,$rootScope:Yd,$q:Zd,$sce:$d,$sceDelegate:ae,$sniffer:be,$templateCache:ce,$timeout:de,$window:ee,$$rAF:fe,$$asyncCallback:ge})}])}function ab(b){return b.replace(he,function(a,b,d,e){return e?d.toUpperCase():d}).replace(ie,"Moz$1")}function Gb(b,a,c,d){function e(b){var e=c&&b?[this.filter(b)]:
|
||||
[this],k=a,m,l,n,q,p,s;if(!d||null!=b)for(;e.length;)for(m=e.shift(),l=0,n=m.length;l<n;l++)for(q=A(m[l]),k?q.triggerHandler("$destroy"):k=!k,p=0,q=(s=q.children()).length;p<q;p++)e.push(Fa(s[p]));return f.apply(this,arguments)}var f=Fa.fn[b],f=f.$original||f;e.$original=f;Fa.fn[b]=e}function S(b){if(b instanceof S)return b;G(b)&&(b=$(b));if(!(this instanceof S)){if(G(b)&&"<"!=b.charAt(0))throw Hb("nosel");return new S(b)}if(G(b)){var a=b;b=X;var c;if(c=je.exec(a))b=[b.createElement(c[1])];else{var d=
|
||||
b,e;b=d.createDocumentFragment();c=[];if(Ib.test(a)){d=b.appendChild(d.createElement("div"));e=(ke.exec(a)||["",""])[1].toLowerCase();e=da[e]||da._default;d.innerHTML="<div> </div>"+e[1]+a.replace(le,"<$1></$2>")+e[2];d.removeChild(d.firstChild);for(a=e[0];a--;)d=d.lastChild;a=0;for(e=d.childNodes.length;a<e;++a)c.push(d.childNodes[a]);d=b.firstChild;d.textContent=""}else c.push(d.createTextNode(a));b.textContent="";b.innerHTML="";b=c}Jb(this,b);A(X.createDocumentFragment()).append(this)}else Jb(this,
|
||||
b)}function Kb(b){return b.cloneNode(!0)}function Ma(b){Lb(b);var a=0;for(b=b.childNodes||[];a<b.length;a++)Ma(b[a])}function lc(b,a,c,d){if(D(d))throw Hb("offargs");var e=pa(b,"events");pa(b,"handle")&&(F(a)?r(e,function(a,c){bb(b,c,a);delete e[c]}):r(a.split(" "),function(a){F(c)?(bb(b,a,e[a]),delete e[a]):Ua(e[a]||[],c)}))}function Lb(b,a){var c=b.ng339,d=cb[c];d&&(a?delete cb[c].data[a]:(d.handle&&(d.events.$destroy&&d.handle({},"$destroy"),lc(b)),delete cb[c],b.ng339=u))}function pa(b,a,c){var d=
|
||||
b.ng339,d=cb[d||-1];if(D(c))d||(b.ng339=d=++me,d=cb[d]={}),d[a]=c;else return d&&d[a]}function Mb(b,a,c){var d=pa(b,"data"),e=D(c),f=!e&&D(a),g=f&&!T(a);d||g||pa(b,"data",d={});if(e)d[a]=c;else if(f){if(g)return d&&d[a];E(d,a)}else return d}function Nb(b,a){return b.getAttribute?-1<(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+a+" "):!1}function ob(b,a){a&&b.setAttribute&&r(a.split(" "),function(a){b.setAttribute("class",$((" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g,
|
||||
" ").replace(" "+$(a)+" "," ")))})}function pb(b,a){if(a&&b.setAttribute){var c=(" "+(b.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ");r(a.split(" "),function(a){a=$(a);-1===c.indexOf(" "+a+" ")&&(c+=a+" ")});b.setAttribute("class",$(c))}}function Jb(b,a){if(a){a=a.nodeName||!D(a.length)||Ja(a)?[a]:a;for(var c=0;c<a.length;c++)b.push(a[c])}}function mc(b,a){return qb(b,"$"+(a||"ngController")+"Controller")}function qb(b,a,c){9==b.nodeType&&(b=b.documentElement);for(a=L(a)?a:[a];b;){for(var d=
|
||||
0,e=a.length;d<e;d++)if((c=A.data(b,a[d]))!==u)return c;b=b.parentNode||11===b.nodeType&&b.host}}function nc(b){for(var a=0,c=b.childNodes;a<c.length;a++)Ma(c[a]);for(;b.firstChild;)b.removeChild(b.firstChild)}function oc(b,a){var c=rb[a.toLowerCase()];return c&&pc[b.nodeName]&&c}function ne(b,a){var c=function(c,e){c.preventDefault||(c.preventDefault=function(){c.returnValue=!1});c.stopPropagation||(c.stopPropagation=function(){c.cancelBubble=!0});c.target||(c.target=c.srcElement||X);if(F(c.defaultPrevented)){var f=
|
||||
c.preventDefault;c.preventDefault=function(){c.defaultPrevented=!0;f.call(c)};c.defaultPrevented=!1}c.isDefaultPrevented=function(){return c.defaultPrevented||!1===c.returnValue};var g=ha(a[e||c.type]||[]);r(g,function(a){a.call(b,c)});8>=R?(c.preventDefault=null,c.stopPropagation=null,c.isDefaultPrevented=null):(delete c.preventDefault,delete c.stopPropagation,delete c.isDefaultPrevented)};c.elem=b;return c}function Na(b,a){var c=typeof b,d;"function"==c||"object"==c&&null!==b?"function"==typeof(d=
|
||||
b.$$hashKey)?d=b.$$hashKey():d===u&&(d=b.$$hashKey=(a||ib)()):d=b;return c+":"+d}function db(b,a){if(a){var c=0;this.nextUid=function(){return++c}}r(b,this.put,this)}function qc(b){var a,c;"function"===typeof b?(a=b.$inject)||(a=[],b.length&&(c=b.toString().replace(oe,""),c=c.match(pe),r(c[1].split(qe),function(b){b.replace(re,function(b,c,d){a.push(d)})})),b.$inject=a):L(b)?(c=b.length-1,Ya(b[c],"fn"),a=b.slice(0,c)):Ya(b,"fn",!0);return a}function ec(b){function a(a){return function(b,c){if(T(b))r(b,
|
||||
Yb(a));else return a(b,c)}}function c(a,b){Ea(a,"service");if(N(b)||L(b))b=n.instantiate(b);if(!b.$get)throw eb("pget",a);return l[a+h]=b}function d(a,b){return c(a,{$get:b})}function e(a){var b=[],c,d,f,h;r(a,function(a){if(!m.get(a)){m.put(a,!0);try{if(G(a))for(c=$a(a),b=b.concat(e(c.requires)).concat(c._runBlocks),d=c._invokeQueue,f=0,h=d.length;f<h;f++){var g=d[f],k=n.get(g[0]);k[g[1]].apply(k,g[2])}else N(a)?b.push(n.invoke(a)):L(a)?b.push(n.invoke(a)):Ya(a,"module")}catch(p){throw L(a)&&(a=
|
||||
a[a.length-1]),p.message&&(p.stack&&-1==p.stack.indexOf(p.message))&&(p=p.message+"\n"+p.stack),eb("modulerr",a,p.stack||p.message||p);}}});return b}function f(a,b){function c(d){if(a.hasOwnProperty(d)){if(a[d]===g)throw eb("cdep",d+" <- "+k.join(" <- "));return a[d]}try{return k.unshift(d),a[d]=g,a[d]=b(d)}catch(e){throw a[d]===g&&delete a[d],e;}finally{k.shift()}}function d(a,b,e){var f=[],h=qc(a),g,k,p;k=0;for(g=h.length;k<g;k++){p=h[k];if("string"!==typeof p)throw eb("itkn",p);f.push(e&&e.hasOwnProperty(p)?
|
||||
e[p]:c(p))}L(a)&&(a=a[g]);return a.apply(b,f)}return{invoke:d,instantiate:function(a,b){var c=function(){},e;c.prototype=(L(a)?a[a.length-1]:a).prototype;c=new c;e=d(a,c,b);return T(e)||N(e)?e:c},get:c,annotate:qc,has:function(b){return l.hasOwnProperty(b+h)||a.hasOwnProperty(b)}}}var g={},h="Provider",k=[],m=new db([],!0),l={$provide:{provider:a(c),factory:a(d),service:a(function(a,b){return d(a,["$injector",function(a){return a.instantiate(b)}])}),value:a(function(a,b){return d(a,aa(b))}),constant:a(function(a,
|
||||
b){Ea(a,"constant");l[a]=b;q[a]=b}),decorator:function(a,b){var c=n.get(a+h),d=c.$get;c.$get=function(){var a=p.invoke(d,c);return p.invoke(b,null,{$delegate:a})}}}},n=l.$injector=f(l,function(){throw eb("unpr",k.join(" <- "));}),q={},p=q.$injector=f(q,function(a){a=n.get(a+h);return p.invoke(a.$get,a)});r(e(b),function(a){p.invoke(a||v)});return p}function Kd(){var b=!0;this.disableAutoScrolling=function(){b=!1};this.$get=["$window","$location","$rootScope",function(a,c,d){function e(a){var b=null;
|
||||
r(a,function(a){b||"a"!==x(a.nodeName)||(b=a)});return b}function f(){var b=c.hash(),d;b?(d=g.getElementById(b))?d.scrollIntoView():(d=e(g.getElementsByName(b)))?d.scrollIntoView():"top"===b&&a.scrollTo(0,0):a.scrollTo(0,0)}var g=a.document;b&&d.$watch(function(){return c.hash()},function(){d.$evalAsync(f)});return f}]}function ge(){this.$get=["$$rAF","$timeout",function(b,a){return b.supported?function(a){return b(a)}:function(b){return a(b,0,!1)}}]}function se(b,a,c,d){function e(a){try{a.apply(null,
|
||||
wa.call(arguments,1))}finally{if(s--,0===s)for(;J.length;)try{J.pop()()}catch(b){c.error(b)}}}function f(a,b){(function ea(){r(w,function(a){a()});t=b(ea,a)})()}function g(){y!=h.url()&&(y=h.url(),r(ba,function(a){a(h.url())}))}var h=this,k=a[0],m=b.location,l=b.history,n=b.setTimeout,q=b.clearTimeout,p={};h.isMock=!1;var s=0,J=[];h.$$completeOutstandingRequest=e;h.$$incOutstandingRequestCount=function(){s++};h.notifyWhenNoOutstandingRequests=function(a){r(w,function(a){a()});0===s?a():J.push(a)};
|
||||
var w=[],t;h.addPollFn=function(a){F(t)&&f(100,n);w.push(a);return a};var y=m.href,K=a.find("base"),B=null;h.url=function(a,c){m!==b.location&&(m=b.location);l!==b.history&&(l=b.history);if(a){if(y!=a){var e=y&&Ga(y)===Ga(a);y=a;!e&&d.history?c?l.replaceState(null,"",a):(l.pushState(null,"",a),K.attr("href",K.attr("href"))):(e||(B=a),c?m.replace(a):m.href=a);return h}}else return B||m.href.replace(/%27/g,"'")};var ba=[],O=!1;h.onUrlChange=function(a){if(!O){if(d.history)A(b).on("popstate",g);if(d.hashchange)A(b).on("hashchange",
|
||||
g);else h.addPollFn(g);O=!0}ba.push(a);return a};h.$$checkUrlChange=g;h.baseHref=function(){var a=K.attr("href");return a?a.replace(/^(https?\:)?\/\/[^\/]*/,""):""};var M={},ca="",P=h.baseHref();h.cookies=function(a,b){var d,e,f,h;if(a)b===u?k.cookie=escape(a)+"=;path="+P+";expires=Thu, 01 Jan 1970 00:00:00 GMT":G(b)&&(d=(k.cookie=escape(a)+"="+escape(b)+";path="+P).length+1,4096<d&&c.warn("Cookie '"+a+"' possibly not set or overflowed because it was too large ("+d+" > 4096 bytes)!"));else{if(k.cookie!==
|
||||
ca)for(ca=k.cookie,d=ca.split("; "),M={},f=0;f<d.length;f++)e=d[f],h=e.indexOf("="),0<h&&(a=unescape(e.substring(0,h)),M[a]===u&&(M[a]=unescape(e.substring(h+1))));return M}};h.defer=function(a,b){var c;s++;c=n(function(){delete p[c];e(a)},b||0);p[c]=!0;return c};h.defer.cancel=function(a){return p[a]?(delete p[a],q(a),e(v),!0):!1}}function Md(){this.$get=["$window","$log","$sniffer","$document",function(b,a,c,d){return new se(b,d,a,c)}]}function Nd(){this.$get=function(){function b(b,d){function e(a){a!=
|
||||
n&&(q?q==a&&(q=a.n):q=a,f(a.n,a.p),f(a,n),n=a,n.n=null)}function f(a,b){a!=b&&(a&&(a.p=b),b&&(b.n=a))}if(b in a)throw z("$cacheFactory")("iid",b);var g=0,h=E({},d,{id:b}),k={},m=d&&d.capacity||Number.MAX_VALUE,l={},n=null,q=null;return a[b]={put:function(a,b){if(m<Number.MAX_VALUE){var c=l[a]||(l[a]={key:a});e(c)}if(!F(b))return a in k||g++,k[a]=b,g>m&&this.remove(q.key),b},get:function(a){if(m<Number.MAX_VALUE){var b=l[a];if(!b)return;e(b)}return k[a]},remove:function(a){if(m<Number.MAX_VALUE){var b=
|
||||
l[a];if(!b)return;b==n&&(n=b.p);b==q&&(q=b.n);f(b.n,b.p);delete l[a]}delete k[a];g--},removeAll:function(){k={};g=0;l={};n=q=null},destroy:function(){l=h=k=null;delete a[b]},info:function(){return E({},h,{size:g})}}}var a={};b.info=function(){var b={};r(a,function(a,e){b[e]=a.info()});return b};b.get=function(b){return a[b]};return b}}function ce(){this.$get=["$cacheFactory",function(b){return b("templates")}]}function gc(b,a){var c={},d="Directive",e=/^\s*directive\:\s*([\d\w_\-]+)\s+(.*)$/,f=/(([\d\w_\-]+)(?:\:([^;]+))?;?)/,
|
||||
g=/^(on[a-z]+|formaction)$/;this.directive=function k(a,e){Ea(a,"directive");G(a)?(Db(e,"directiveFactory"),c.hasOwnProperty(a)||(c[a]=[],b.factory(a+d,["$injector","$exceptionHandler",function(b,d){var e=[];r(c[a],function(c,f){try{var g=b.invoke(c);N(g)?g={compile:aa(g)}:!g.compile&&g.link&&(g.compile=aa(g.link));g.priority=g.priority||0;g.index=f;g.name=g.name||a;g.require=g.require||g.controller&&g.name;g.restrict=g.restrict||"A";e.push(g)}catch(k){d(k)}});return e}])),c[a].push(e)):r(a,Yb(k));
|
||||
return this};this.aHrefSanitizationWhitelist=function(b){return D(b)?(a.aHrefSanitizationWhitelist(b),this):a.aHrefSanitizationWhitelist()};this.imgSrcSanitizationWhitelist=function(b){return D(b)?(a.imgSrcSanitizationWhitelist(b),this):a.imgSrcSanitizationWhitelist()};this.$get=["$injector","$interpolate","$exceptionHandler","$http","$templateCache","$parse","$controller","$rootScope","$document","$sce","$animate","$$sanitizeUri",function(a,b,l,n,q,p,s,J,w,t,y,K){function B(a,b,c,d,e){a instanceof
|
||||
A||(a=A(a));r(a,function(b,c){3==b.nodeType&&b.nodeValue.match(/\S+/)&&(a[c]=A(b).wrap("<span></span>").parent()[0])});var f=O(a,b,a,c,d,e);ba(a,"ng-scope");return function(b,c,d,e){Db(b,"scope");var g=c?Oa.clone.call(a):a;r(d,function(a,b){g.data("$"+b+"Controller",a)});d=0;for(var k=g.length;d<k;d++){var p=g[d].nodeType;1!==p&&9!==p||g.eq(d).data("$scope",b)}c&&c(g,b);f&&f(b,g,g,e);return g}}function ba(a,b){try{a.addClass(b)}catch(c){}}function O(a,b,c,d,e,f){function g(a,c,d,e){var f,p,l,m,q,
|
||||
n,w;f=c.length;var s=Array(f);for(m=0;m<f;m++)s[m]=c[m];n=m=0;for(q=k.length;m<q;n++)p=s[n],c=k[m++],f=k[m++],c?(c.scope?(l=a.$new(),A.data(p,"$scope",l)):l=a,w=c.transcludeOnThisElement?M(a,c.transclude,e):!c.templateOnThisElement&&e?e:!e&&b?M(a,b):null,c(f,l,p,d,w)):f&&f(a,p.childNodes,u,e)}for(var k=[],p,l,m,q,n=0;n<a.length;n++)p=new Ob,l=ca(a[n],[],p,0===n?d:u,e),(f=l.length?I(l,a[n],p,b,c,null,[],[],f):null)&&f.scope&&ba(p.$$element,"ng-scope"),p=f&&f.terminal||!(m=a[n].childNodes)||!m.length?
|
||||
null:O(m,f?(f.transcludeOnThisElement||!f.templateOnThisElement)&&f.transclude:b),k.push(f,p),q=q||f||p,f=null;return q?g:null}function M(a,b,c){return function(d,e,f){var g=!1;d||(d=a.$new(),g=d.$$transcluded=!0);e=b(d,e,f,c);if(g)e.on("$destroy",function(){d.$destroy()});return e}}function ca(a,b,c,d,g){var k=c.$attr,p;switch(a.nodeType){case 1:ea(b,qa(Pa(a).toLowerCase()),"E",d,g);for(var l,m,q,n=a.attributes,w=0,s=n&&n.length;w<s;w++){var t=!1,J=!1;l=n[w];if(!R||8<=R||l.specified){p=l.name;m=
|
||||
$(l.value);l=qa(p);if(q=U.test(l))p=nb(l.substr(6),"-");var y=l.replace(/(Start|End)$/,"");l===y+"Start"&&(t=p,J=p.substr(0,p.length-5)+"end",p=p.substr(0,p.length-6));l=qa(p.toLowerCase());k[l]=p;if(q||!c.hasOwnProperty(l))c[l]=m,oc(a,l)&&(c[l]=!0);S(a,b,m,l);ea(b,l,"A",d,g,t,J)}}a=a.className;if(G(a)&&""!==a)for(;p=f.exec(a);)l=qa(p[2]),ea(b,l,"C",d,g)&&(c[l]=$(p[3])),a=a.substr(p.index+p[0].length);break;case 3:x(b,a.nodeValue);break;case 8:try{if(p=e.exec(a.nodeValue))l=qa(p[1]),ea(b,l,"M",d,
|
||||
g)&&(c[l]=$(p[2]))}catch(B){}}b.sort(F);return b}function P(a,b,c){var d=[],e=0;if(b&&a.hasAttribute&&a.hasAttribute(b)){do{if(!a)throw ja("uterdir",b,c);1==a.nodeType&&(a.hasAttribute(b)&&e++,a.hasAttribute(c)&&e--);d.push(a);a=a.nextSibling}while(0<e)}else d.push(a);return A(d)}function C(a,b,c){return function(d,e,f,g,k){e=P(e[0],b,c);return a(d,e,f,g,k)}}function I(a,c,d,e,f,g,k,q,n){function w(a,b,c,d){if(a){c&&(a=C(a,c,d));a.require=H.require;a.directiveName=z;if(K===H||H.$$isolateScope)a=rc(a,
|
||||
{isolateScope:!0});k.push(a)}if(b){c&&(b=C(b,c,d));b.require=H.require;b.directiveName=z;if(K===H||H.$$isolateScope)b=rc(b,{isolateScope:!0});q.push(b)}}function t(a,b,c,d){var e,f="data",g=!1;if(G(b)){for(;"^"==(e=b.charAt(0))||"?"==e;)b=b.substr(1),"^"==e&&(f="inheritedData"),g=g||"?"==e;e=null;d&&"data"===f&&(e=d[b]);e=e||c[f]("$"+b+"Controller");if(!e&&!g)throw ja("ctreq",b,a);}else L(b)&&(e=[],r(b,function(b){e.push(t(a,b,c,d))}));return e}function J(a,e,f,g,n){function w(a,b){var c;2>arguments.length&&
|
||||
(b=a,a=u);Ia&&(c=ca);return n(a,b,c)}var y,Q,B,M,C,P,ca={},ra;y=c===f?d:ha(d,new Ob(A(f),d.$attr));Q=y.$$element;if(K){var ue=/^\s*([@=&])(\??)\s*(\w*)\s*$/;P=e.$new(!0);!I||I!==K&&I!==K.$$originalDirective?Q.data("$isolateScopeNoTemplate",P):Q.data("$isolateScope",P);ba(Q,"ng-isolate-scope");r(K.scope,function(a,c){var d=a.match(ue)||[],f=d[3]||c,g="?"==d[2],d=d[1],k,l,n,q;P.$$isolateBindings[c]=d+f;switch(d){case "@":y.$observe(f,function(a){P[c]=a});y.$$observers[f].$$scope=e;y[f]&&(P[c]=b(y[f])(e));
|
||||
break;case "=":if(g&&!y[f])break;l=p(y[f]);q=l.literal?Ca:function(a,b){return a===b||a!==a&&b!==b};n=l.assign||function(){k=P[c]=l(e);throw ja("nonassign",y[f],K.name);};k=P[c]=l(e);P.$watch(function(){var a=l(e);q(a,P[c])||(q(a,k)?n(e,a=P[c]):P[c]=a);return k=a},null,l.literal);break;case "&":l=p(y[f]);P[c]=function(a){return l(e,a)};break;default:throw ja("iscp",K.name,c,a);}})}ra=n&&w;O&&r(O,function(a){var b={$scope:a===K||a.$$isolateScope?P:e,$element:Q,$attrs:y,$transclude:ra},c;C=a.controller;
|
||||
"@"==C&&(C=y[a.name]);c=s(C,b);ca[a.name]=c;Ia||Q.data("$"+a.name+"Controller",c);a.controllerAs&&(b.$scope[a.controllerAs]=c)});g=0;for(B=k.length;g<B;g++)try{M=k[g],M(M.isolateScope?P:e,Q,y,M.require&&t(M.directiveName,M.require,Q,ca),ra)}catch(H){l(H,ia(Q))}g=e;K&&(K.template||null===K.templateUrl)&&(g=P);a&&a(g,f.childNodes,u,n);for(g=q.length-1;0<=g;g--)try{M=q[g],M(M.isolateScope?P:e,Q,y,M.require&&t(M.directiveName,M.require,Q,ca),ra)}catch(D){l(D,ia(Q))}}n=n||{};for(var y=-Number.MAX_VALUE,
|
||||
M,O=n.controllerDirectives,K=n.newIsolateScopeDirective,I=n.templateDirective,ea=n.nonTlbTranscludeDirective,F=!1,E=!1,Ia=n.hasElementTranscludeDirective,x=d.$$element=A(c),H,z,V,S=e,R,Ha=0,sa=a.length;Ha<sa;Ha++){H=a[Ha];var U=H.$$start,Y=H.$$end;U&&(x=P(c,U,Y));V=u;if(y>H.priority)break;if(V=H.scope)M=M||H,H.templateUrl||(fb("new/isolated scope",K,H,x),T(V)&&(K=H));z=H.name;!H.templateUrl&&H.controller&&(V=H.controller,O=O||{},fb("'"+z+"' controller",O[z],H,x),O[z]=H);if(V=H.transclude)F=!0,H.$$tlb||
|
||||
(fb("transclusion",ea,H,x),ea=H),"element"==V?(Ia=!0,y=H.priority,V=x,x=d.$$element=A(X.createComment(" "+z+": "+d[z]+" ")),c=x[0],ra(f,wa.call(V,0),c),S=B(V,e,y,g&&g.name,{nonTlbTranscludeDirective:ea})):(V=A(Kb(c)).contents(),x.empty(),S=B(V,e));if(H.template)if(E=!0,fb("template",I,H,x),I=H,V=N(H.template)?H.template(x,d):H.template,V=W(V),H.replace){g=H;V=Ib.test(V)?A($(V)):[];c=V[0];if(1!=V.length||1!==c.nodeType)throw ja("tplrt",z,"");ra(f,x,c);sa={$attr:{}};V=ca(c,[],sa);var Z=a.splice(Ha+
|
||||
1,a.length-(Ha+1));K&&D(V);a=a.concat(V).concat(Z);v(d,sa);sa=a.length}else x.html(V);if(H.templateUrl)E=!0,fb("template",I,H,x),I=H,H.replace&&(g=H),J=te(a.splice(Ha,a.length-Ha),x,d,f,F&&S,k,q,{controllerDirectives:O,newIsolateScopeDirective:K,templateDirective:I,nonTlbTranscludeDirective:ea}),sa=a.length;else if(H.compile)try{R=H.compile(x,d,S),N(R)?w(null,R,U,Y):R&&w(R.pre,R.post,U,Y)}catch(ve){l(ve,ia(x))}H.terminal&&(J.terminal=!0,y=Math.max(y,H.priority))}J.scope=M&&!0===M.scope;J.transcludeOnThisElement=
|
||||
F;J.templateOnThisElement=E;J.transclude=S;n.hasElementTranscludeDirective=Ia;return J}function D(a){for(var b=0,c=a.length;b<c;b++)a[b]=$b(a[b],{$$isolateScope:!0})}function ea(b,e,f,g,p,m,n){if(e===p)return null;p=null;if(c.hasOwnProperty(e)){var q;e=a.get(e+d);for(var w=0,s=e.length;w<s;w++)try{q=e[w],(g===u||g>q.priority)&&-1!=q.restrict.indexOf(f)&&(m&&(q=$b(q,{$$start:m,$$end:n})),b.push(q),p=q)}catch(y){l(y)}}return p}function v(a,b){var c=b.$attr,d=a.$attr,e=a.$$element;r(a,function(d,e){"$"!=
|
||||
e.charAt(0)&&(b[e]&&b[e]!==d&&(d+=("style"===e?";":" ")+b[e]),a.$set(e,d,!0,c[e]))});r(b,function(b,f){"class"==f?(ba(e,b),a["class"]=(a["class"]?a["class"]+" ":"")+b):"style"==f?(e.attr("style",e.attr("style")+";"+b),a.style=(a.style?a.style+";":"")+b):"$"==f.charAt(0)||a.hasOwnProperty(f)||(a[f]=b,d[f]=c[f])})}function te(a,b,c,d,e,f,g,k){var p=[],l,m,w=b[0],s=a.shift(),y=E({},s,{templateUrl:null,transclude:null,replace:null,$$originalDirective:s}),J=N(s.templateUrl)?s.templateUrl(b,c):s.templateUrl;
|
||||
b.empty();n.get(t.getTrustedResourceUrl(J),{cache:q}).success(function(q){var n,t;q=W(q);if(s.replace){q=Ib.test(q)?A($(q)):[];n=q[0];if(1!=q.length||1!==n.nodeType)throw ja("tplrt",s.name,J);q={$attr:{}};ra(d,b,n);var B=ca(n,[],q);T(s.scope)&&D(B);a=B.concat(a);v(c,q)}else n=w,b.html(q);a.unshift(y);l=I(a,n,c,e,b,s,f,g,k);r(d,function(a,c){a==n&&(d[c]=b[0])});for(m=O(b[0].childNodes,e);p.length;){q=p.shift();t=p.shift();var K=p.shift(),C=p.shift(),B=b[0];if(t!==w){var P=t.className;k.hasElementTranscludeDirective&&
|
||||
s.replace||(B=Kb(n));ra(K,A(t),B);ba(A(B),P)}t=l.transcludeOnThisElement?M(q,l.transclude,C):C;l(m,q,B,d,t)}p=null}).error(function(a,b,c,d){throw ja("tpload",d.url);});return function(a,b,c,d,e){a=e;p?(p.push(b),p.push(c),p.push(d),p.push(a)):(l.transcludeOnThisElement&&(a=M(b,l.transclude,e)),l(m,b,c,d,a))}}function F(a,b){var c=b.priority-a.priority;return 0!==c?c:a.name!==b.name?a.name<b.name?-1:1:a.index-b.index}function fb(a,b,c,d){if(b)throw ja("multidir",b.name,c.name,a,ia(d));}function x(a,
|
||||
c){var d=b(c,!0);d&&a.push({priority:0,compile:function(a){var b=a.parent().length;b&&ba(a.parent(),"ng-binding");return function(a,c){var e=c.parent(),f=e.data("$binding")||[];f.push(d);e.data("$binding",f);b||ba(e,"ng-binding");a.$watch(d,function(a){c[0].nodeValue=a})}}})}function z(a,b){if("srcdoc"==b)return t.HTML;var c=Pa(a);if("xlinkHref"==b||"FORM"==c&&"action"==b||"IMG"!=c&&("src"==b||"ngSrc"==b))return t.RESOURCE_URL}function S(a,c,d,e){var f=b(d,!0);if(f){if("multiple"===e&&"SELECT"===
|
||||
Pa(a))throw ja("selmulti",ia(a));c.push({priority:100,compile:function(){return{pre:function(c,d,k){d=k.$$observers||(k.$$observers={});if(g.test(e))throw ja("nodomevents");if(f=b(k[e],!0,z(a,e)))k[e]=f(c),(d[e]||(d[e]=[])).$$inter=!0,(k.$$observers&&k.$$observers[e].$$scope||c).$watch(f,function(a,b){"class"===e&&a!=b?k.$updateClass(a,b):k.$set(e,a)})}}}})}}function ra(a,b,c){var d=b[0],e=b.length,f=d.parentNode,g,k;if(a)for(g=0,k=a.length;g<k;g++)if(a[g]==d){a[g++]=c;k=g+e-1;for(var p=a.length;g<
|
||||
p;g++,k++)k<p?a[g]=a[k]:delete a[g];a.length-=e-1;break}f&&f.replaceChild(c,d);a=X.createDocumentFragment();a.appendChild(d);c[A.expando]=d[A.expando];d=1;for(e=b.length;d<e;d++)f=b[d],A(f).remove(),a.appendChild(f),delete b[d];b[0]=c;b.length=1}function rc(a,b){return E(function(){return a.apply(null,arguments)},a,b)}var Ob=function(a,b){this.$$element=a;this.$attr=b||{}};Ob.prototype={$normalize:qa,$addClass:function(a){a&&0<a.length&&y.addClass(this.$$element,a)},$removeClass:function(a){a&&0<
|
||||
a.length&&y.removeClass(this.$$element,a)},$updateClass:function(a,b){var c=sc(a,b),d=sc(b,a);0===c.length?y.removeClass(this.$$element,d):0===d.length?y.addClass(this.$$element,c):y.setClass(this.$$element,c,d)},$set:function(a,b,c,d){var e=oc(this.$$element[0],a);e&&(this.$$element.prop(a,b),d=e);this[a]=b;d?this.$attr[a]=d:(d=this.$attr[a])||(this.$attr[a]=d=nb(a,"-"));e=Pa(this.$$element);if("A"===e&&"href"===a||"IMG"===e&&"src"===a)this[a]=b=K(b,"src"===a);!1!==c&&(null===b||b===u?this.$$element.removeAttr(d):
|
||||
this.$$element.attr(d,b));(c=this.$$observers)&&r(c[a],function(a){try{a(b)}catch(c){l(c)}})},$observe:function(a,b){var c=this,d=c.$$observers||(c.$$observers={}),e=d[a]||(d[a]=[]);e.push(b);J.$evalAsync(function(){e.$$inter||b(c[a])});return b}};var sa=b.startSymbol(),Ia=b.endSymbol(),W="{{"==sa||"}}"==Ia?ga:function(a){return a.replace(/\{\{/g,sa).replace(/}}/g,Ia)},U=/^ngAttr[A-Z]/;return B}]}function qa(b){return ab(b.replace(we,""))}function sc(b,a){var c="",d=b.split(/\s+/),e=a.split(/\s+/),
|
||||
f=0;a:for(;f<d.length;f++){for(var g=d[f],h=0;h<e.length;h++)if(g==e[h])continue a;c+=(0<c.length?" ":"")+g}return c}function Od(){var b={},a=/^(\S+)(\s+as\s+(\w+))?$/;this.register=function(a,d){Ea(a,"controller");T(a)?E(b,a):b[a]=d};this.$get=["$injector","$window",function(c,d){return function(e,f){var g,h,k;G(e)&&(g=e.match(a),h=g[1],k=g[3],e=b.hasOwnProperty(h)?b[h]:fc(f.$scope,h,!0)||fc(d,h,!0),Ya(e,h,!0));g=c.instantiate(e,f);if(k){if(!f||"object"!==typeof f.$scope)throw z("$controller")("noscp",
|
||||
h||e.name,k);f.$scope[k]=g}return g}}]}function Pd(){this.$get=["$window",function(b){return A(b.document)}]}function Qd(){this.$get=["$log",function(b){return function(a,c){b.error.apply(b,arguments)}}]}function tc(b){var a={},c,d,e;if(!b)return a;r(b.split("\n"),function(b){e=b.indexOf(":");c=x($(b.substr(0,e)));d=$(b.substr(e+1));c&&(a[c]=a[c]?a[c]+", "+d:d)});return a}function uc(b){var a=T(b)?b:u;return function(c){a||(a=tc(b));return c?a[x(c)]||null:a}}function vc(b,a,c){if(N(c))return c(b,
|
||||
a);r(c,function(c){b=c(b,a)});return b}function Td(){var b=/^\s*(\[|\{[^\{])/,a=/[\}\]]\s*$/,c=/^\)\]\}',?\n/,d={"Content-Type":"application/json;charset=utf-8"},e=this.defaults={transformResponse:[function(d){G(d)&&(d=d.replace(c,""),b.test(d)&&a.test(d)&&(d=ac(d)));return d}],transformRequest:[function(a){return T(a)&&"[object File]"!==Ba.call(a)&&"[object Blob]"!==Ba.call(a)?oa(a):a}],headers:{common:{Accept:"application/json, text/plain, */*"},post:ha(d),put:ha(d),patch:ha(d)},xsrfCookieName:"XSRF-TOKEN",
|
||||
xsrfHeaderName:"X-XSRF-TOKEN"},f=this.interceptors=[],g=this.responseInterceptors=[];this.$get=["$httpBackend","$browser","$cacheFactory","$rootScope","$q","$injector",function(a,b,c,d,n,q){function p(a){function b(a){var d=E({},a,{data:vc(a.data,a.headers,c.transformResponse)});return 200<=a.status&&300>a.status?d:n.reject(d)}var c={method:"get",transformRequest:e.transformRequest,transformResponse:e.transformResponse},d=function(a){var b=e.headers,c=E({},a.headers),d,f,b=E({},b.common,b[x(a.method)]);
|
||||
a:for(d in b){a=x(d);for(f in c)if(x(f)===a)continue a;c[d]=b[d]}(function(a){var b;r(a,function(c,d){N(c)&&(b=c(),null!=b?a[d]=b:delete a[d])})})(c);return c}(a);E(c,a);c.headers=d;c.method=La(c.method);var f=[function(a){d=a.headers;var c=vc(a.data,uc(d),a.transformRequest);F(c)&&r(d,function(a,b){"content-type"===x(b)&&delete d[b]});F(a.withCredentials)&&!F(e.withCredentials)&&(a.withCredentials=e.withCredentials);return s(a,c,d).then(b,b)},u],g=n.when(c);for(r(t,function(a){(a.request||a.requestError)&&
|
||||
f.unshift(a.request,a.requestError);(a.response||a.responseError)&&f.push(a.response,a.responseError)});f.length;){a=f.shift();var h=f.shift(),g=g.then(a,h)}g.success=function(a){g.then(function(b){a(b.data,b.status,b.headers,c)});return g};g.error=function(a){g.then(null,function(b){a(b.data,b.status,b.headers,c)});return g};return g}function s(c,f,g){function m(a,b,c,e){C&&(200<=a&&300>a?C.put(A,[a,b,tc(c),e]):C.remove(A));q(b,a,c,e);d.$$phase||d.$apply()}function q(a,b,d,e){b=Math.max(b,0);(200<=
|
||||
b&&300>b?t.resolve:t.reject)({data:a,status:b,headers:uc(d),config:c,statusText:e})}function s(){var a=Ta(p.pendingRequests,c);-1!==a&&p.pendingRequests.splice(a,1)}var t=n.defer(),r=t.promise,C,I,A=J(c.url,c.params);p.pendingRequests.push(c);r.then(s,s);!c.cache&&!e.cache||(!1===c.cache||"GET"!==c.method&&"JSONP"!==c.method)||(C=T(c.cache)?c.cache:T(e.cache)?e.cache:w);if(C)if(I=C.get(A),D(I)){if(I&&N(I.then))return I.then(s,s),I;L(I)?q(I[1],I[0],ha(I[2]),I[3]):q(I,200,{},"OK")}else C.put(A,r);F(I)&&
|
||||
((I=Pb(c.url)?b.cookies()[c.xsrfCookieName||e.xsrfCookieName]:u)&&(g[c.xsrfHeaderName||e.xsrfHeaderName]=I),a(c.method,A,f,m,g,c.timeout,c.withCredentials,c.responseType));return r}function J(a,b){if(!b)return a;var c=[];Sc(b,function(a,b){null===a||F(a)||(L(a)||(a=[a]),r(a,function(a){T(a)&&(a=va(a)?a.toISOString():oa(a));c.push(Da(b)+"="+Da(a))}))});0<c.length&&(a+=(-1==a.indexOf("?")?"?":"&")+c.join("&"));return a}var w=c("$http"),t=[];r(f,function(a){t.unshift(G(a)?q.get(a):q.invoke(a))});r(g,
|
||||
function(a,b){var c=G(a)?q.get(a):q.invoke(a);t.splice(b,0,{response:function(a){return c(n.when(a))},responseError:function(a){return c(n.reject(a))}})});p.pendingRequests=[];(function(a){r(arguments,function(a){p[a]=function(b,c){return p(E(c||{},{method:a,url:b}))}})})("get","delete","head","jsonp");(function(a){r(arguments,function(a){p[a]=function(b,c,d){return p(E(d||{},{method:a,url:b,data:c}))}})})("post","put","patch");p.defaults=e;return p}]}function xe(b){if(8>=R&&(!b.match(/^(get|post|head|put|delete|options)$/i)||
|
||||
!W.XMLHttpRequest))return new W.ActiveXObject("Microsoft.XMLHTTP");if(W.XMLHttpRequest)return new W.XMLHttpRequest;throw z("$httpBackend")("noxhr");}function Ud(){this.$get=["$browser","$window","$document",function(b,a,c){return ye(b,xe,b.defer,a.angular.callbacks,c[0])}]}function ye(b,a,c,d,e){function f(a,b,c){var f=e.createElement("script"),g=null;f.type="text/javascript";f.src=a;f.async=!0;g=function(a){bb(f,"load",g);bb(f,"error",g);e.body.removeChild(f);f=null;var h=-1,s="unknown";a&&("load"!==
|
||||
a.type||d[b].called||(a={type:"error"}),s=a.type,h="error"===a.type?404:200);c&&c(h,s)};sb(f,"load",g);sb(f,"error",g);8>=R&&(f.onreadystatechange=function(){G(f.readyState)&&/loaded|complete/.test(f.readyState)&&(f.onreadystatechange=null,g({type:"load"}))});e.body.appendChild(f);return g}var g=-1;return function(e,k,m,l,n,q,p,s){function J(){t=g;K&&K();B&&B.abort()}function w(a,d,e,f,g){O&&c.cancel(O);K=B=null;0===d&&(d=e?200:"file"==xa(k).protocol?404:0);a(1223===d?204:d,e,f,g||"");b.$$completeOutstandingRequest(v)}
|
||||
var t;b.$$incOutstandingRequestCount();k=k||b.url();if("jsonp"==x(e)){var y="_"+(d.counter++).toString(36);d[y]=function(a){d[y].data=a;d[y].called=!0};var K=f(k.replace("JSON_CALLBACK","angular.callbacks."+y),y,function(a,b){w(l,a,d[y].data,"",b);d[y]=v})}else{var B=a(e);B.open(e,k,!0);r(n,function(a,b){D(a)&&B.setRequestHeader(b,a)});B.onreadystatechange=function(){if(B&&4==B.readyState){var a=null,b=null,c="";t!==g&&(a=B.getAllResponseHeaders(),b="response"in B?B.response:B.responseText);t===g&&
|
||||
10>R||(c=B.statusText);w(l,t||B.status,b,a,c)}};p&&(B.withCredentials=!0);if(s)try{B.responseType=s}catch(ba){if("json"!==s)throw ba;}B.send(m||null)}if(0<q)var O=c(J,q);else q&&N(q.then)&&q.then(J)}}function Rd(){var b="{{",a="}}";this.startSymbol=function(a){return a?(b=a,this):b};this.endSymbol=function(b){return b?(a=b,this):a};this.$get=["$parse","$exceptionHandler","$sce",function(c,d,e){function f(f,m,l){for(var n,q,p=0,s=[],J=f.length,w=!1,t=[];p<J;)-1!=(n=f.indexOf(b,p))&&-1!=(q=f.indexOf(a,
|
||||
n+g))?(p!=n&&s.push(f.substring(p,n)),s.push(p=c(w=f.substring(n+g,q))),p.exp=w,p=q+h,w=!0):(p!=J&&s.push(f.substring(p)),p=J);(J=s.length)||(s.push(""),J=1);if(l&&1<s.length)throw wc("noconcat",f);if(!m||w)return t.length=J,p=function(a){try{for(var b=0,c=J,g;b<c;b++){if("function"==typeof(g=s[b]))if(g=g(a),g=l?e.getTrusted(l,g):e.valueOf(g),null==g)g="";else switch(typeof g){case "string":break;case "number":g=""+g;break;default:g=oa(g)}t[b]=g}return t.join("")}catch(h){a=wc("interr",f,h.toString()),
|
||||
d(a)}},p.exp=f,p.parts=s,p}var g=b.length,h=a.length;f.startSymbol=function(){return b};f.endSymbol=function(){return a};return f}]}function Sd(){this.$get=["$rootScope","$window","$q",function(b,a,c){function d(d,g,h,k){var m=a.setInterval,l=a.clearInterval,n=c.defer(),q=n.promise,p=0,s=D(k)&&!k;h=D(h)?h:0;q.then(null,null,d);q.$$intervalId=m(function(){n.notify(p++);0<h&&p>=h&&(n.resolve(p),l(q.$$intervalId),delete e[q.$$intervalId]);s||b.$apply()},g);e[q.$$intervalId]=n;return q}var e={};d.cancel=
|
||||
function(b){return b&&b.$$intervalId in e?(e[b.$$intervalId].reject("canceled"),a.clearInterval(b.$$intervalId),delete e[b.$$intervalId],!0):!1};return d}]}function ad(){this.$get=function(){return{id:"en-us",NUMBER_FORMATS:{DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{minInt:1,minFrac:0,maxFrac:3,posPre:"",posSuf:"",negPre:"-",negSuf:"",gSize:3,lgSize:3},{minInt:1,minFrac:2,maxFrac:2,posPre:"\u00a4",posSuf:"",negPre:"(\u00a4",negSuf:")",gSize:3,lgSize:3}],CURRENCY_SYM:"$"},DATETIME_FORMATS:{MONTH:"January February March April May June July August September October November December".split(" "),
|
||||
SHORTMONTH:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),DAY:"Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "),SHORTDAY:"Sun Mon Tue Wed Thu Fri Sat".split(" "),AMPMS:["AM","PM"],medium:"MMM d, y h:mm:ss a","short":"M/d/yy h:mm a",fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",mediumDate:"MMM d, y",shortDate:"M/d/yy",mediumTime:"h:mm:ss a",shortTime:"h:mm a"},pluralCat:function(b){return 1===b?"one":"other"}}}}function Qb(b){b=b.split("/");for(var a=b.length;a--;)b[a]=
|
||||
mb(b[a]);return b.join("/")}function xc(b,a,c){b=xa(b,c);a.$$protocol=b.protocol;a.$$host=b.hostname;a.$$port=U(b.port)||ze[b.protocol]||null}function yc(b,a,c){var d="/"!==b.charAt(0);d&&(b="/"+b);b=xa(b,c);a.$$path=decodeURIComponent(d&&"/"===b.pathname.charAt(0)?b.pathname.substring(1):b.pathname);a.$$search=cc(b.search);a.$$hash=decodeURIComponent(b.hash);a.$$path&&"/"!=a.$$path.charAt(0)&&(a.$$path="/"+a.$$path)}function ta(b,a){if(0===a.indexOf(b))return a.substr(b.length)}function Ga(b){var a=
|
||||
b.indexOf("#");return-1==a?b:b.substr(0,a)}function Rb(b){return b.substr(0,Ga(b).lastIndexOf("/")+1)}function zc(b,a){this.$$html5=!0;a=a||"";var c=Rb(b);xc(b,this,b);this.$$parse=function(a){var e=ta(c,a);if(!G(e))throw Sb("ipthprfx",a,c);yc(e,this,b);this.$$path||(this.$$path="/");this.$$compose()};this.$$compose=function(){var a=Cb(this.$$search),b=this.$$hash?"#"+mb(this.$$hash):"";this.$$url=Qb(this.$$path)+(a?"?"+a:"")+b;this.$$absUrl=c+this.$$url.substr(1)};this.$$parseLinkUrl=function(d,
|
||||
e){var f,g;(f=ta(b,d))!==u?(g=f,g=(f=ta(a,f))!==u?c+(ta("/",f)||f):b+g):(f=ta(c,d))!==u?g=c+f:c==d+"/"&&(g=c);g&&this.$$parse(g);return!!g}}function Tb(b,a){var c=Rb(b);xc(b,this,b);this.$$parse=function(d){var e=ta(b,d)||ta(c,d),e="#"==e.charAt(0)?ta(a,e):this.$$html5?e:"";if(!G(e))throw Sb("ihshprfx",d,a);yc(e,this,b);d=this.$$path;var f=/^\/[A-Z]:(\/.*)/;0===e.indexOf(b)&&(e=e.replace(b,""));f.exec(e)||(d=(e=f.exec(d))?e[1]:d);this.$$path=d;this.$$compose()};this.$$compose=function(){var c=Cb(this.$$search),
|
||||
e=this.$$hash?"#"+mb(this.$$hash):"";this.$$url=Qb(this.$$path)+(c?"?"+c:"")+e;this.$$absUrl=b+(this.$$url?a+this.$$url:"")};this.$$parseLinkUrl=function(a,c){return Ga(b)==Ga(a)?(this.$$parse(a),!0):!1}}function Ac(b,a){this.$$html5=!0;Tb.apply(this,arguments);var c=Rb(b);this.$$parseLinkUrl=function(d,e){var f,g;b==Ga(d)?f=d:(g=ta(c,d))?f=b+a+g:c===d+"/"&&(f=c);f&&this.$$parse(f);return!!f};this.$$compose=function(){var c=Cb(this.$$search),e=this.$$hash?"#"+mb(this.$$hash):"";this.$$url=Qb(this.$$path)+
|
||||
(c?"?"+c:"")+e;this.$$absUrl=b+a+this.$$url}}function tb(b){return function(){return this[b]}}function Bc(b,a){return function(c){if(F(c))return this[b];this[b]=a(c);this.$$compose();return this}}function Vd(){var b="",a=!1;this.hashPrefix=function(a){return D(a)?(b=a,this):b};this.html5Mode=function(b){return D(b)?(a=b,this):a};this.$get=["$rootScope","$browser","$sniffer","$rootElement",function(c,d,e,f){function g(a){c.$broadcast("$locationChangeSuccess",h.absUrl(),a)}var h,k=d.baseHref(),m=d.url();
|
||||
a?(k=m.substring(0,m.indexOf("/",m.indexOf("//")+2))+(k||"/"),e=e.history?zc:Ac):(k=Ga(m),e=Tb);h=new e(k,"#"+b);h.$$parseLinkUrl(m,m);var l=/^\s*(javascript|mailto):/i;f.on("click",function(a){if(!a.ctrlKey&&!a.metaKey&&2!=a.which){for(var b=A(a.target);"a"!==x(b[0].nodeName);)if(b[0]===f[0]||!(b=b.parent())[0])return;var e=b.prop("href"),g=b.attr("href")||b.attr("xlink:href");T(e)&&"[object SVGAnimatedString]"===e.toString()&&(e=xa(e.animVal).href);l.test(e)||(!e||(b.attr("target")||a.isDefaultPrevented())||
|
||||
!h.$$parseLinkUrl(e,g))||(a.preventDefault(),h.absUrl()!=d.url()&&(c.$apply(),W.angular["ff-684208-preventDefault"]=!0))}});h.absUrl()!=m&&d.url(h.absUrl(),!0);d.onUrlChange(function(a){h.absUrl()!=a&&(c.$evalAsync(function(){var b=h.absUrl();h.$$parse(a);c.$broadcast("$locationChangeStart",a,b).defaultPrevented?(h.$$parse(b),d.url(b)):g(b)}),c.$$phase||c.$digest())});var n=0;c.$watch(function(){var a=d.url(),b=h.$$replace;n&&a==h.absUrl()||(n++,c.$evalAsync(function(){c.$broadcast("$locationChangeStart",
|
||||
h.absUrl(),a).defaultPrevented?h.$$parse(a):(d.url(h.absUrl(),b),g(a))}));h.$$replace=!1;return n});return h}]}function Wd(){var b=!0,a=this;this.debugEnabled=function(a){return D(a)?(b=a,this):b};this.$get=["$window",function(c){function d(a){a instanceof Error&&(a.stack?a=a.message&&-1===a.stack.indexOf(a.message)?"Error: "+a.message+"\n"+a.stack:a.stack:a.sourceURL&&(a=a.message+"\n"+a.sourceURL+":"+a.line));return a}function e(a){var b=c.console||{},e=b[a]||b.log||v;a=!1;try{a=!!e.apply}catch(k){}return a?
|
||||
function(){var a=[];r(arguments,function(b){a.push(d(b))});return e.apply(b,a)}:function(a,b){e(a,null==b?"":b)}}return{log:e("log"),info:e("info"),warn:e("warn"),error:e("error"),debug:function(){var c=e("debug");return function(){b&&c.apply(a,arguments)}}()}}]}function ka(b,a){if("__defineGetter__"===b||"__defineSetter__"===b||"__lookupGetter__"===b||"__lookupSetter__"===b||"__proto__"===b)throw la("isecfld",a);return b}function ma(b,a){if(b){if(b.constructor===b)throw la("isecfn",a);if(b.document&&
|
||||
b.location&&b.alert&&b.setInterval)throw la("isecwindow",a);if(b.children&&(b.nodeName||b.prop&&b.attr&&b.find))throw la("isecdom",a);if(b===Object)throw la("isecobj",a);}return b}function ub(b,a,c,d,e){ma(b,d);e=e||{};a=a.split(".");for(var f,g=0;1<a.length;g++){f=ka(a.shift(),d);var h=ma(b[f],d);h||(h={},b[f]=h);b=h;b.then&&e.unwrapPromises&&(ya(d),"$$v"in b||function(a){a.then(function(b){a.$$v=b})}(b),b.$$v===u&&(b.$$v={}),b=b.$$v)}f=ka(a.shift(),d);ma(b[f],d);return b[f]=c}function Qa(b){return"constructor"==
|
||||
b}function Cc(b,a,c,d,e,f,g){ka(b,f);ka(a,f);ka(c,f);ka(d,f);ka(e,f);var h=function(a){return ma(a,f)},k=g.expensiveChecks,m=k||Qa(b)?h:ga,l=k||Qa(a)?h:ga,n=k||Qa(c)?h:ga,q=k||Qa(d)?h:ga,p=k||Qa(e)?h:ga;return g.unwrapPromises?function(g,h){var k=h&&h.hasOwnProperty(b)?h:g,t;if(null==k)return k;(k=m(k[b]))&&k.then&&(ya(f),"$$v"in k||(t=k,t.$$v=u,t.then(function(a){t.$$v=m(a)})),k=m(k.$$v));if(!a)return k;if(null==k)return u;(k=l(k[a]))&&k.then&&(ya(f),"$$v"in k||(t=k,t.$$v=u,t.then(function(a){t.$$v=
|
||||
l(a)})),k=l(k.$$v));if(!c)return k;if(null==k)return u;(k=n(k[c]))&&k.then&&(ya(f),"$$v"in k||(t=k,t.$$v=u,t.then(function(a){t.$$v=n(a)})),k=n(k.$$v));if(!d)return k;if(null==k)return u;(k=q(k[d]))&&k.then&&(ya(f),"$$v"in k||(t=k,t.$$v=u,t.then(function(a){t.$$v=q(a)})),k=q(k.$$v));if(!e)return k;if(null==k)return u;(k=p(k[e]))&&k.then&&(ya(f),"$$v"in k||(t=k,t.$$v=u,t.then(function(a){t.$$v=p(a)})),k=p(k.$$v));return k}:function(f,g){var h=g&&g.hasOwnProperty(b)?g:f;if(null==h)return h;h=m(h[b]);
|
||||
if(!a)return h;if(null==h)return u;h=l(h[a]);if(!c)return h;if(null==h)return u;h=n(h[c]);if(!d)return h;if(null==h)return u;h=q(h[d]);return e?null==h?u:h=p(h[e]):h}}function Ae(b,a){return function(c,d){return b(c,d,ya,ma,a)}}function Dc(b,a,c){var d=a.expensiveChecks,e=d?Be:Ce;if(e.hasOwnProperty(b))return e[b];var f=b.split("."),g=f.length,h;if(a.csp)h=6>g?Cc(f[0],f[1],f[2],f[3],f[4],c,a):function(b,d){var e=0,h;do h=Cc(f[e++],f[e++],f[e++],f[e++],f[e++],c,a)(b,d),d=u,b=h;while(e<g);return h};
|
||||
else{var k="var p;\n";d&&(k+="s = eso(s, fe);\nl = eso(l, fe);\n");var m=d;r(f,function(b,e){ka(b,c);var f=(e?"s":'((l&&l.hasOwnProperty("'+b+'"))?l:s)')+'["'+b+'"]',g=d||Qa(b);g&&(f="eso("+f+", fe)",m=!0);k+="if(s == null) return undefined;\ns="+f+";\n";a.unwrapPromises&&(k+='if (s && s.then) {\n pw("'+c.replace(/(["\r\n])/g,"\\$1")+'");\n if (!("$$v" in s)) {\n p=s;\n p.$$v = undefined;\n p.then(function(v) {p.$$v='+(g?"eso(v)":"v")+";});\n}\n s="+(g?"eso(s.$$v)":"s.$$v")+"\n}\n")});k+="return s;";
|
||||
h=new Function("s","l","pw","eso","fe",k);h.toString=aa(k);if(m||a.unwrapPromises)h=Ae(h,c)}"hasOwnProperty"!==b&&(e[b]=h);return h}function Xd(){var b={},a={},c={csp:!1,unwrapPromises:!1,logPromiseWarnings:!0,expensiveChecks:!1};this.unwrapPromises=function(a){return D(a)?(c.unwrapPromises=!!a,this):c.unwrapPromises};this.logPromiseWarnings=function(a){return D(a)?(c.logPromiseWarnings=a,this):c.logPromiseWarnings};this.$get=["$filter","$sniffer","$log",function(d,e,f){c.csp=e.csp;var g={csp:c.csp,
|
||||
unwrapPromises:c.unwrapPromises,logPromiseWarnings:c.logPromiseWarnings,expensiveChecks:!0};ya=function(a){c.logPromiseWarnings&&!Ec.hasOwnProperty(a)&&(Ec[a]=!0,f.warn("[$parse] Promise found in the expression `"+a+"`. Automatic unwrapping of promises in Angular expressions is deprecated."))};return function(e,f){var m;switch(typeof e){case "string":var l=f?a:b;if(l.hasOwnProperty(e))return l[e];m=f?g:c;var n=new Ub(m);m=(new gb(n,d,m)).parse(e);"hasOwnProperty"!==e&&(l[e]=m);return m;case "function":return e;
|
||||
default:return v}}}]}function Zd(){this.$get=["$rootScope","$exceptionHandler",function(b,a){return De(function(a){b.$evalAsync(a)},a)}]}function De(b,a){function c(a){return a}function d(a){return g(a)}var e=function(){var g=[],m,l;return l={resolve:function(a){if(g){var c=g;g=u;m=f(a);c.length&&b(function(){for(var a,b=0,d=c.length;b<d;b++)a=c[b],m.then(a[0],a[1],a[2])})}},reject:function(a){l.resolve(h(a))},notify:function(a){if(g){var c=g;g.length&&b(function(){for(var b,d=0,e=c.length;d<e;d++)b=
|
||||
c[d],b[2](a)})}},promise:{then:function(b,f,h){var l=e(),J=function(d){try{l.resolve((N(b)?b:c)(d))}catch(e){l.reject(e),a(e)}},w=function(b){try{l.resolve((N(f)?f:d)(b))}catch(c){l.reject(c),a(c)}},t=function(b){try{l.notify((N(h)?h:c)(b))}catch(d){a(d)}};g?g.push([J,w,t]):m.then(J,w,t);return l.promise},"catch":function(a){return this.then(null,a)},"finally":function(a){function b(a,c){var d=e();c?d.resolve(a):d.reject(a);return d.promise}function d(e,f){var g=null;try{g=(a||c)()}catch(h){return b(h,
|
||||
!1)}return g&&N(g.then)?g.then(function(){return b(e,f)},function(a){return b(a,!1)}):b(e,f)}return this.then(function(a){return d(a,!0)},function(a){return d(a,!1)})}}}},f=function(a){return a&&N(a.then)?a:{then:function(c){var d=e();b(function(){d.resolve(c(a))});return d.promise}}},g=function(a){var b=e();b.reject(a);return b.promise},h=function(c){return{then:function(f,g){var h=e();b(function(){try{h.resolve((N(g)?g:d)(c))}catch(b){h.reject(b),a(b)}});return h.promise}}};return{defer:e,reject:g,
|
||||
when:function(h,m,l,n){var q=e(),p,s=function(b){try{return(N(m)?m:c)(b)}catch(d){return a(d),g(d)}},J=function(b){try{return(N(l)?l:d)(b)}catch(c){return a(c),g(c)}},w=function(b){try{return(N(n)?n:c)(b)}catch(d){a(d)}};b(function(){f(h).then(function(a){p||(p=!0,q.resolve(f(a).then(s,J,w)))},function(a){p||(p=!0,q.resolve(J(a)))},function(a){p||q.notify(w(a))})});return q.promise},all:function(a){var b=e(),c=0,d=L(a)?[]:{};r(a,function(a,e){c++;f(a).then(function(a){d.hasOwnProperty(e)||(d[e]=a,
|
||||
--c||b.resolve(d))},function(a){d.hasOwnProperty(e)||b.reject(a)})});0===c&&b.resolve(d);return b.promise}}}function fe(){this.$get=["$window","$timeout",function(b,a){var c=b.requestAnimationFrame||b.webkitRequestAnimationFrame||b.mozRequestAnimationFrame,d=b.cancelAnimationFrame||b.webkitCancelAnimationFrame||b.mozCancelAnimationFrame||b.webkitCancelRequestAnimationFrame,e=!!c,f=e?function(a){var b=c(a);return function(){d(b)}}:function(b){var c=a(b,16.66,!1);return function(){a.cancel(c)}};f.supported=
|
||||
e;return f}]}function Yd(){var b=10,a=z("$rootScope"),c=null;this.digestTtl=function(a){arguments.length&&(b=a);return b};this.$get=["$injector","$exceptionHandler","$parse","$browser",function(d,e,f,g){function h(){this.$id=ib();this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null;this["this"]=this.$root=this;this.$$destroyed=!1;this.$$asyncQueue=[];this.$$postDigestQueue=[];this.$$listeners={};this.$$listenerCount={};this.$$isolateBindings=
|
||||
{}}function k(b){if(q.$$phase)throw a("inprog",q.$$phase);q.$$phase=b}function m(a,b){var c=f(a);Ya(c,b);return c}function l(a,b,c){do a.$$listenerCount[c]-=b,0===a.$$listenerCount[c]&&delete a.$$listenerCount[c];while(a=a.$parent)}function n(){}h.prototype={constructor:h,$new:function(a){a?(a=new h,a.$root=this.$root,a.$$asyncQueue=this.$$asyncQueue,a.$$postDigestQueue=this.$$postDigestQueue):(this.$$childScopeClass||(this.$$childScopeClass=function(){this.$$watchers=this.$$nextSibling=this.$$childHead=
|
||||
this.$$childTail=null;this.$$listeners={};this.$$listenerCount={};this.$id=ib();this.$$childScopeClass=null},this.$$childScopeClass.prototype=this),a=new this.$$childScopeClass);a["this"]=a;a.$parent=this;a.$$prevSibling=this.$$childTail;this.$$childHead?this.$$childTail=this.$$childTail.$$nextSibling=a:this.$$childHead=this.$$childTail=a;return a},$watch:function(a,b,d){var e=m(a,"watch"),f=this.$$watchers,g={fn:b,last:n,get:e,exp:a,eq:!!d};c=null;if(!N(b)){var h=m(b||v,"listener");g.fn=function(a,
|
||||
b,c){h(c)}}if("string"==typeof a&&e.constant){var k=g.fn;g.fn=function(a,b,c){k.call(this,a,b,c);Ua(f,g)}}f||(f=this.$$watchers=[]);f.unshift(g);return function(){Ua(f,g);c=null}},$watchCollection:function(a,b){var c=this,d,e,g,h=1<b.length,k=0,l=f(a),m=[],n={},q=!0,r=0;return this.$watch(function(){d=l(c);var a,b,f;if(T(d))if(Sa(d))for(e!==m&&(e=m,r=e.length=0,k++),a=d.length,r!==a&&(k++,e.length=r=a),b=0;b<a;b++)f=e[b]!==e[b]&&d[b]!==d[b],f||e[b]===d[b]||(k++,e[b]=d[b]);else{e!==n&&(e=n={},r=0,
|
||||
k++);a=0;for(b in d)d.hasOwnProperty(b)&&(a++,e.hasOwnProperty(b)?(f=e[b]!==e[b]&&d[b]!==d[b],f||e[b]===d[b]||(k++,e[b]=d[b])):(r++,e[b]=d[b],k++));if(r>a)for(b in k++,e)e.hasOwnProperty(b)&&!d.hasOwnProperty(b)&&(r--,delete e[b])}else e!==d&&(e=d,k++);return k},function(){q?(q=!1,b(d,d,c)):b(d,g,c);if(h)if(T(d))if(Sa(d)){g=Array(d.length);for(var a=0;a<d.length;a++)g[a]=d[a]}else for(a in g={},d)lb.call(d,a)&&(g[a]=d[a]);else g=d})},$digest:function(){var d,f,h,l,m=this.$$asyncQueue,r=this.$$postDigestQueue,
|
||||
K,B,u=b,O,M=[],A,P,C;k("$digest");g.$$checkUrlChange();c=null;do{B=!1;for(O=this;m.length;){try{C=m.shift(),C.scope.$eval(C.expression)}catch(I){q.$$phase=null,e(I)}c=null}a:do{if(l=O.$$watchers)for(K=l.length;K--;)try{if(d=l[K])if((f=d.get(O))!==(h=d.last)&&!(d.eq?Ca(f,h):"number"===typeof f&&"number"===typeof h&&isNaN(f)&&isNaN(h)))B=!0,c=d,d.last=d.eq?Ka(f,null):f,d.fn(f,h===n?f:h,O),5>u&&(A=4-u,M[A]||(M[A]=[]),P=N(d.exp)?"fn: "+(d.exp.name||d.exp.toString()):d.exp,P+="; newVal: "+oa(f)+"; oldVal: "+
|
||||
oa(h),M[A].push(P));else if(d===c){B=!1;break a}}catch(D){q.$$phase=null,e(D)}if(!(l=O.$$childHead||O!==this&&O.$$nextSibling))for(;O!==this&&!(l=O.$$nextSibling);)O=O.$parent}while(O=l);if((B||m.length)&&!u--)throw q.$$phase=null,a("infdig",b,oa(M));}while(B||m.length);for(q.$$phase=null;r.length;)try{r.shift()()}catch(x){e(x)}},$destroy:function(){if(!this.$$destroyed){var a=this.$parent;this.$broadcast("$destroy");this.$$destroyed=!0;this!==q&&(r(this.$$listenerCount,Bb(null,l,this)),a.$$childHead==
|
||||
this&&(a.$$childHead=this.$$nextSibling),a.$$childTail==this&&(a.$$childTail=this.$$prevSibling),this.$$prevSibling&&(this.$$prevSibling.$$nextSibling=this.$$nextSibling),this.$$nextSibling&&(this.$$nextSibling.$$prevSibling=this.$$prevSibling),this.$parent=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=this.$root=null,this.$$listeners={},this.$$watchers=this.$$asyncQueue=this.$$postDigestQueue=[],this.$destroy=this.$digest=this.$apply=v,this.$on=this.$watch=function(){return v})}},
|
||||
$eval:function(a,b){return f(a)(this,b)},$evalAsync:function(a){q.$$phase||q.$$asyncQueue.length||g.defer(function(){q.$$asyncQueue.length&&q.$digest()});this.$$asyncQueue.push({scope:this,expression:a})},$$postDigest:function(a){this.$$postDigestQueue.push(a)},$apply:function(a){try{return k("$apply"),this.$eval(a)}catch(b){e(b)}finally{q.$$phase=null;try{q.$digest()}catch(c){throw e(c),c;}}},$on:function(a,b){var c=this.$$listeners[a];c||(this.$$listeners[a]=c=[]);c.push(b);var d=this;do d.$$listenerCount[a]||
|
||||
(d.$$listenerCount[a]=0),d.$$listenerCount[a]++;while(d=d.$parent);var e=this;return function(){var d=Ta(c,b);-1!==d&&(c[d]=null,l(e,1,a))}},$emit:function(a,b){var c=[],d,f=this,g=!1,h={name:a,targetScope:f,stopPropagation:function(){g=!0},preventDefault:function(){h.defaultPrevented=!0},defaultPrevented:!1},k=[h].concat(wa.call(arguments,1)),l,m;do{d=f.$$listeners[a]||c;h.currentScope=f;l=0;for(m=d.length;l<m;l++)if(d[l])try{d[l].apply(null,k)}catch(n){e(n)}else d.splice(l,1),l--,m--;if(g)break;
|
||||
f=f.$parent}while(f);return h},$broadcast:function(a,b){for(var c=this,d=this,f={name:a,targetScope:this,preventDefault:function(){f.defaultPrevented=!0},defaultPrevented:!1},g=[f].concat(wa.call(arguments,1)),h,k;c=d;){f.currentScope=c;d=c.$$listeners[a]||[];h=0;for(k=d.length;h<k;h++)if(d[h])try{d[h].apply(null,g)}catch(l){e(l)}else d.splice(h,1),h--,k--;if(!(d=c.$$listenerCount[a]&&c.$$childHead||c!==this&&c.$$nextSibling))for(;c!==this&&!(d=c.$$nextSibling);)c=c.$parent}return f}};var q=new h;
|
||||
return q}]}function bd(){var b=/^\s*(https?|ftp|mailto|tel|file):/,a=/^\s*((https?|ftp|file):|data:image\/)/;this.aHrefSanitizationWhitelist=function(a){return D(a)?(b=a,this):b};this.imgSrcSanitizationWhitelist=function(b){return D(b)?(a=b,this):a};this.$get=function(){return function(c,d){var e=d?a:b,f;if(!R||8<=R)if(f=xa(c).href,""!==f&&!f.match(e))return"unsafe:"+f;return c}}}function Ee(b){if("self"===b)return b;if(G(b)){if(-1<b.indexOf("***"))throw za("iwcard",b);b=b.replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,
|
||||
"\\$1").replace(/\x08/g,"\\x08").replace("\\*\\*",".*").replace("\\*","[^:/.?&;]*");return RegExp("^"+b+"$")}if(kb(b))return RegExp("^"+b.source+"$");throw za("imatcher");}function Fc(b){var a=[];D(b)&&r(b,function(b){a.push(Ee(b))});return a}function ae(){this.SCE_CONTEXTS=fa;var b=["self"],a=[];this.resourceUrlWhitelist=function(a){arguments.length&&(b=Fc(a));return b};this.resourceUrlBlacklist=function(b){arguments.length&&(a=Fc(b));return a};this.$get=["$injector",function(c){function d(a){var b=
|
||||
function(a){this.$$unwrapTrustedValue=function(){return a}};a&&(b.prototype=new a);b.prototype.valueOf=function(){return this.$$unwrapTrustedValue()};b.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()};return b}var e=function(a){throw za("unsafe");};c.has("$sanitize")&&(e=c.get("$sanitize"));var f=d(),g={};g[fa.HTML]=d(f);g[fa.CSS]=d(f);g[fa.URL]=d(f);g[fa.JS]=d(f);g[fa.RESOURCE_URL]=d(g[fa.URL]);return{trustAs:function(a,b){var c=g.hasOwnProperty(a)?g[a]:null;if(!c)throw za("icontext",
|
||||
a,b);if(null===b||b===u||""===b)return b;if("string"!==typeof b)throw za("itype",a);return new c(b)},getTrusted:function(c,d){if(null===d||d===u||""===d)return d;var f=g.hasOwnProperty(c)?g[c]:null;if(f&&d instanceof f)return d.$$unwrapTrustedValue();if(c===fa.RESOURCE_URL){var f=xa(d.toString()),l,n,q=!1;l=0;for(n=b.length;l<n;l++)if("self"===b[l]?Pb(f):b[l].exec(f.href)){q=!0;break}if(q)for(l=0,n=a.length;l<n;l++)if("self"===a[l]?Pb(f):a[l].exec(f.href)){q=!1;break}if(q)return d;throw za("insecurl",
|
||||
d.toString());}if(c===fa.HTML)return e(d);throw za("unsafe");},valueOf:function(a){return a instanceof f?a.$$unwrapTrustedValue():a}}}]}function $d(){var b=!0;this.enabled=function(a){arguments.length&&(b=!!a);return b};this.$get=["$parse","$sniffer","$sceDelegate",function(a,c,d){if(b&&c.msie&&8>c.msieDocumentMode)throw za("iequirks");var e=ha(fa);e.isEnabled=function(){return b};e.trustAs=d.trustAs;e.getTrusted=d.getTrusted;e.valueOf=d.valueOf;b||(e.trustAs=e.getTrusted=function(a,b){return b},
|
||||
e.valueOf=ga);e.parseAs=function(b,c){var d=a(c);return d.literal&&d.constant?d:function(a,c){return e.getTrusted(b,d(a,c))}};var f=e.parseAs,g=e.getTrusted,h=e.trustAs;r(fa,function(a,b){var c=x(b);e[ab("parse_as_"+c)]=function(b){return f(a,b)};e[ab("get_trusted_"+c)]=function(b){return g(a,b)};e[ab("trust_as_"+c)]=function(b){return h(a,b)}});return e}]}function be(){this.$get=["$window","$document",function(b,a){var c={},d=U((/android (\d+)/.exec(x((b.navigator||{}).userAgent))||[])[1]),e=/Boxee/i.test((b.navigator||
|
||||
{}).userAgent),f=a[0]||{},g=f.documentMode,h,k=/^(Moz|webkit|O|ms)(?=[A-Z])/,m=f.body&&f.body.style,l=!1,n=!1;if(m){for(var q in m)if(l=k.exec(q)){h=l[0];h=h.substr(0,1).toUpperCase()+h.substr(1);break}h||(h="WebkitOpacity"in m&&"webkit");l=!!("transition"in m||h+"Transition"in m);n=!!("animation"in m||h+"Animation"in m);!d||l&&n||(l=G(f.body.style.webkitTransition),n=G(f.body.style.webkitAnimation))}return{history:!(!b.history||!b.history.pushState||4>d||e),hashchange:"onhashchange"in b&&(!g||7<
|
||||
g),hasEvent:function(a){if("input"==a&&9==R)return!1;if(F(c[a])){var b=f.createElement("div");c[a]="on"+a in b}return c[a]},csp:Za(),vendorPrefix:h,transitions:l,animations:n,android:d,msie:R,msieDocumentMode:g}}]}function de(){this.$get=["$rootScope","$browser","$q","$exceptionHandler",function(b,a,c,d){function e(e,h,k){var m=c.defer(),l=m.promise,n=D(k)&&!k;h=a.defer(function(){try{m.resolve(e())}catch(a){m.reject(a),d(a)}finally{delete f[l.$$timeoutId]}n||b.$apply()},h);l.$$timeoutId=h;f[h]=m;
|
||||
return l}var f={};e.cancel=function(b){return b&&b.$$timeoutId in f?(f[b.$$timeoutId].reject("canceled"),delete f[b.$$timeoutId],a.defer.cancel(b.$$timeoutId)):!1};return e}]}function xa(b,a){var c=b;R&&(Y.setAttribute("href",c),c=Y.href);Y.setAttribute("href",c);return{href:Y.href,protocol:Y.protocol?Y.protocol.replace(/:$/,""):"",host:Y.host,search:Y.search?Y.search.replace(/^\?/,""):"",hash:Y.hash?Y.hash.replace(/^#/,""):"",hostname:Y.hostname,port:Y.port,pathname:"/"===Y.pathname.charAt(0)?Y.pathname:
|
||||
"/"+Y.pathname}}function Pb(b){b=G(b)?xa(b):b;return b.protocol===Gc.protocol&&b.host===Gc.host}function ee(){this.$get=aa(W)}function kc(b){function a(d,e){if(T(d)){var f={};r(d,function(b,c){f[c]=a(c,b)});return f}return b.factory(d+c,e)}var c="Filter";this.register=a;this.$get=["$injector",function(a){return function(b){return a.get(b+c)}}];a("currency",Hc);a("date",Ic);a("filter",Fe);a("json",Ge);a("limitTo",He);a("lowercase",Ie);a("number",Jc);a("orderBy",Kc);a("uppercase",Je)}function Fe(){return function(b,
|
||||
a,c){if(!L(b))return b;var d=typeof c,e=[];e.check=function(a){for(var b=0;b<e.length;b++)if(!e[b](a))return!1;return!0};"function"!==d&&(c="boolean"===d&&c?function(a,b){return Xa.equals(a,b)}:function(a,b){if(a&&b&&"object"===typeof a&&"object"===typeof b){for(var d in a)if("$"!==d.charAt(0)&&lb.call(a,d)&&c(a[d],b[d]))return!0;return!1}b=(""+b).toLowerCase();return-1<(""+a).toLowerCase().indexOf(b)});var f=function(a,b){if("string"===typeof b&&"!"===b.charAt(0))return!f(a,b.substr(1));switch(typeof a){case "boolean":case "number":case "string":return c(a,
|
||||
b);case "object":switch(typeof b){case "object":return c(a,b);default:for(var d in a)if("$"!==d.charAt(0)&&f(a[d],b))return!0}return!1;case "array":for(d=0;d<a.length;d++)if(f(a[d],b))return!0;return!1;default:return!1}};switch(typeof a){case "boolean":case "number":case "string":a={$:a};case "object":for(var g in a)(function(b){"undefined"!==typeof a[b]&&e.push(function(c){return f("$"==b?c:c&&c[b],a[b])})})(g);break;case "function":e.push(a);break;default:return b}d=[];for(g=0;g<b.length;g++){var h=
|
||||
b[g];e.check(h)&&d.push(h)}return d}}function Hc(b){var a=b.NUMBER_FORMATS;return function(b,d){F(d)&&(d=a.CURRENCY_SYM);return Lc(b,a.PATTERNS[1],a.GROUP_SEP,a.DECIMAL_SEP,2).replace(/\u00A4/g,d)}}function Jc(b){var a=b.NUMBER_FORMATS;return function(b,d){return Lc(b,a.PATTERNS[0],a.GROUP_SEP,a.DECIMAL_SEP,d)}}function Lc(b,a,c,d,e){if(null==b||!isFinite(b)||T(b))return"";var f=0>b;b=Math.abs(b);var g=b+"",h="",k=[],m=!1;if(-1!==g.indexOf("e")){var l=g.match(/([\d\.]+)e(-?)(\d+)/);l&&"-"==l[2]&&
|
||||
l[3]>e+1?(g="0",b=0):(h=g,m=!0)}if(m)0<e&&(-1<b&&1>b)&&(h=b.toFixed(e));else{g=(g.split(Mc)[1]||"").length;F(e)&&(e=Math.min(Math.max(a.minFrac,g),a.maxFrac));b=+(Math.round(+(b.toString()+"e"+e)).toString()+"e"+-e);0===b&&(f=!1);b=(""+b).split(Mc);g=b[0];b=b[1]||"";var l=0,n=a.lgSize,q=a.gSize;if(g.length>=n+q)for(l=g.length-n,m=0;m<l;m++)0===(l-m)%q&&0!==m&&(h+=c),h+=g.charAt(m);for(m=l;m<g.length;m++)0===(g.length-m)%n&&0!==m&&(h+=c),h+=g.charAt(m);for(;b.length<e;)b+="0";e&&"0"!==e&&(h+=d+b.substr(0,
|
||||
e))}k.push(f?a.negPre:a.posPre);k.push(h);k.push(f?a.negSuf:a.posSuf);return k.join("")}function Vb(b,a,c){var d="";0>b&&(d="-",b=-b);for(b=""+b;b.length<a;)b="0"+b;c&&(b=b.substr(b.length-a));return d+b}function Z(b,a,c,d){c=c||0;return function(e){e=e["get"+b]();if(0<c||e>-c)e+=c;0===e&&-12==c&&(e=12);return Vb(e,a,d)}}function vb(b,a){return function(c,d){var e=c["get"+b](),f=La(a?"SHORT"+b:b);return d[f][e]}}function Ic(b){function a(a){var b;if(b=a.match(c)){a=new Date(0);var f=0,g=0,h=b[8]?
|
||||
a.setUTCFullYear:a.setFullYear,k=b[8]?a.setUTCHours:a.setHours;b[9]&&(f=U(b[9]+b[10]),g=U(b[9]+b[11]));h.call(a,U(b[1]),U(b[2])-1,U(b[3]));f=U(b[4]||0)-f;g=U(b[5]||0)-g;h=U(b[6]||0);b=Math.round(1E3*parseFloat("0."+(b[7]||0)));k.call(a,f,g,h,b)}return a}var c=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(c,e){var f="",g=[],h,k;e=e||"mediumDate";e=b.DATETIME_FORMATS[e]||e;G(c)&&(c=Ke.test(c)?U(c):a(c));jb(c)&&(c=new Date(c));
|
||||
if(!va(c))return c;for(;e;)(k=Le.exec(e))?(g=g.concat(wa.call(k,1)),e=g.pop()):(g.push(e),e=null);r(g,function(a){h=Me[a];f+=h?h(c,b.DATETIME_FORMATS):a.replace(/(^'|'$)/g,"").replace(/''/g,"'")});return f}}function Ge(){return function(b){return oa(b,!0)}}function He(){return function(b,a){if(!L(b)&&!G(b))return b;a=Infinity===Math.abs(Number(a))?Number(a):U(a);if(G(b))return a?0<=a?b.slice(0,a):b.slice(a,b.length):"";var c=[],d,e;a>b.length?a=b.length:a<-b.length&&(a=-b.length);0<a?(d=0,e=a):(d=
|
||||
b.length+a,e=b.length);for(;d<e;d++)c.push(b[d]);return c}}function Kc(b){return function(a,c,d){function e(a,b){return Wa(b)?function(b,c){return a(c,b)}:a}function f(a,b){var c=typeof a,d=typeof b;return c==d?(va(a)&&va(b)&&(a=a.valueOf(),b=b.valueOf()),"string"==c&&(a=a.toLowerCase(),b=b.toLowerCase()),a===b?0:a<b?-1:1):c<d?-1:1}if(!Sa(a))return a;c=L(c)?c:[c];0===c.length&&(c=["+"]);c=Uc(c,function(a){var c=!1,d=a||ga;if(G(a)){if("+"==a.charAt(0)||"-"==a.charAt(0))c="-"==a.charAt(0),a=a.substring(1);
|
||||
if(""===a)return e(function(a,b){return f(a,b)},c);d=b(a);if(d.constant){var m=d();return e(function(a,b){return f(a[m],b[m])},c)}}return e(function(a,b){return f(d(a),d(b))},c)});return wa.call(a).sort(e(function(a,b){for(var d=0;d<c.length;d++){var e=c[d](a,b);if(0!==e)return e}return 0},d))}}function Aa(b){N(b)&&(b={link:b});b.restrict=b.restrict||"AC";return aa(b)}function Nc(b,a,c,d){function e(a,c){c=c?"-"+nb(c,"-"):"";d.setClass(b,(a?wb:xb)+c,(a?xb:wb)+c)}var f=this,g=b.parent().controller("form")||
|
||||
yb,h=0,k=f.$error={},m=[];f.$name=a.name||a.ngForm;f.$dirty=!1;f.$pristine=!0;f.$valid=!0;f.$invalid=!1;g.$addControl(f);b.addClass(Ra);e(!0);f.$addControl=function(a){Ea(a.$name,"input");m.push(a);a.$name&&(f[a.$name]=a)};f.$removeControl=function(a){a.$name&&f[a.$name]===a&&delete f[a.$name];r(k,function(b,c){f.$setValidity(c,!0,a)});Ua(m,a)};f.$setValidity=function(a,b,c){var d=k[a];if(b)d&&(Ua(d,c),d.length||(h--,h||(e(b),f.$valid=!0,f.$invalid=!1),k[a]=!1,e(!0,a),g.$setValidity(a,!0,f)));else{h||
|
||||
e(b);if(d){if(-1!=Ta(d,c))return}else k[a]=d=[],h++,e(!1,a),g.$setValidity(a,!1,f);d.push(c);f.$valid=!1;f.$invalid=!0}};f.$setDirty=function(){d.removeClass(b,Ra);d.addClass(b,zb);f.$dirty=!0;f.$pristine=!1;g.$setDirty()};f.$setPristine=function(){d.removeClass(b,zb);d.addClass(b,Ra);f.$dirty=!1;f.$pristine=!0;r(m,function(a){a.$setPristine()})}}function ua(b,a,c,d){b.$setValidity(a,c);return c?d:u}function Oc(b,a){var c,d;if(a)for(c=0;c<a.length;++c)if(d=a[c],b[d])return!0;return!1}function Ne(b,
|
||||
a,c,d,e){T(e)&&(b.$$hasNativeValidators=!0,b.$parsers.push(function(f){if(b.$error[a]||Oc(e,d)||!Oc(e,c))return f;b.$setValidity(a,!1)}))}function Ab(b,a,c,d,e,f){var g=a.prop(Oe),h=a[0].placeholder,k={},m=x(a[0].type);d.$$validityState=g;if(!e.android){var l=!1;a.on("compositionstart",function(a){l=!0});a.on("compositionend",function(){l=!1;n()})}var n=function(e){if(!l){var f=a.val();if(R&&"input"===(e||k).type&&a[0].placeholder!==h)h=a[0].placeholder;else if("password"!==m&&Wa(c.ngTrim||"T")&&
|
||||
(f=$(f)),e=g&&d.$$hasNativeValidators,d.$viewValue!==f||""===f&&e)b.$root.$$phase?d.$setViewValue(f):b.$apply(function(){d.$setViewValue(f)})}};if(e.hasEvent("input"))a.on("input",n);else{var q,p=function(){q||(q=f.defer(function(){n();q=null}))};a.on("keydown",function(a){a=a.keyCode;91===a||(15<a&&19>a||37<=a&&40>=a)||p()});if(e.hasEvent("paste"))a.on("paste cut",p)}a.on("change",n);d.$render=function(){a.val(d.$isEmpty(d.$viewValue)?"":d.$viewValue)};var s=c.ngPattern;s&&((e=s.match(/^\/(.*)\/([gim]*)$/))?
|
||||
(s=RegExp(e[1],e[2]),e=function(a){return ua(d,"pattern",d.$isEmpty(a)||s.test(a),a)}):e=function(c){var e=b.$eval(s);if(!e||!e.test)throw z("ngPattern")("noregexp",s,e,ia(a));return ua(d,"pattern",d.$isEmpty(c)||e.test(c),c)},d.$formatters.push(e),d.$parsers.push(e));if(c.ngMinlength){var r=U(c.ngMinlength);e=function(a){return ua(d,"minlength",d.$isEmpty(a)||a.length>=r,a)};d.$parsers.push(e);d.$formatters.push(e)}if(c.ngMaxlength){var w=U(c.ngMaxlength);e=function(a){return ua(d,"maxlength",d.$isEmpty(a)||
|
||||
a.length<=w,a)};d.$parsers.push(e);d.$formatters.push(e)}}function Wb(b,a){b="ngClass"+b;return["$animate",function(c){function d(a,b){var c=[],d=0;a:for(;d<a.length;d++){for(var e=a[d],l=0;l<b.length;l++)if(e==b[l])continue a;c.push(e)}return c}function e(a){if(!L(a)){if(G(a))return a.split(" ");if(T(a)){var b=[];r(a,function(a,c){a&&(b=b.concat(c.split(" ")))});return b}}return a}return{restrict:"AC",link:function(f,g,h){function k(a,b){var c=g.data("$classCounts")||{},d=[];r(a,function(a){if(0<
|
||||
b||c[a])c[a]=(c[a]||0)+b,c[a]===+(0<b)&&d.push(a)});g.data("$classCounts",c);return d.join(" ")}function m(b){if(!0===a||f.$index%2===a){var m=e(b||[]);if(!l){var p=k(m,1);h.$addClass(p)}else if(!Ca(b,l)){var s=e(l),p=d(m,s),m=d(s,m),m=k(m,-1),p=k(p,1);0===p.length?c.removeClass(g,m):0===m.length?c.addClass(g,p):c.setClass(g,p,m)}}l=ha(b)}var l;f.$watch(h[b],m,!0);h.$observe("class",function(a){m(f.$eval(h[b]))});"ngClass"!==b&&f.$watch("$index",function(c,d){var g=c&1;if(g!==(d&1)){var l=e(f.$eval(h[b]));
|
||||
g===a?(g=k(l,1),h.$addClass(g)):(g=k(l,-1),h.$removeClass(g))}})}}}]}var Oe="validity",x=function(b){return G(b)?b.toLowerCase():b},lb=Object.prototype.hasOwnProperty,La=function(b){return G(b)?b.toUpperCase():b},R,A,Fa,wa=[].slice,Pe=[].push,Ba=Object.prototype.toString,Va=z("ng"),Xa=W.angular||(W.angular={}),$a,Pa,na=["0","0","0"];R=U((/msie (\d+)/.exec(x(navigator.userAgent))||[])[1]);isNaN(R)&&(R=U((/trident\/.*; rv:(\d+)/.exec(x(navigator.userAgent))||[])[1]));v.$inject=[];ga.$inject=[];var L=
|
||||
function(){return N(Array.isArray)?Array.isArray:function(b){return"[object Array]"===Ba.call(b)}}(),$=function(){return String.prototype.trim?function(b){return G(b)?b.trim():b}:function(b){return G(b)?b.replace(/^\s\s*/,"").replace(/\s\s*$/,""):b}}();Pa=9>R?function(b){b=b.nodeName?b:b[0];return b.scopeName&&"HTML"!=b.scopeName?La(b.scopeName+":"+b.nodeName):b.nodeName}:function(b){return b.nodeName?b.nodeName:b[0].nodeName};var Za=function(){if(D(Za.isActive_))return Za.isActive_;var b=!(!X.querySelector("[ng-csp]")&&
|
||||
!X.querySelector("[data-ng-csp]"));if(!b)try{new Function("")}catch(a){b=!0}return Za.isActive_=b},Xc=/[A-Z]/g,$c={full:"1.2.28",major:1,minor:2,dot:28,codeName:"finnish-disembarkation"};S.expando="ng339";var cb=S.cache={},me=1,sb=W.document.addEventListener?function(b,a,c){b.addEventListener(a,c,!1)}:function(b,a,c){b.attachEvent("on"+a,c)},bb=W.document.removeEventListener?function(b,a,c){b.removeEventListener(a,c,!1)}:function(b,a,c){b.detachEvent("on"+a,c)};S._data=function(b){return this.cache[b[this.expando]]||
|
||||
{}};var he=/([\:\-\_]+(.))/g,ie=/^moz([A-Z])/,Hb=z("jqLite"),je=/^<(\w+)\s*\/?>(?:<\/\1>|)$/,Ib=/<|&#?\w+;/,ke=/<([\w:]+)/,le=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/gi,da={option:[1,'<select multiple="multiple">',"</select>"],thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};da.optgroup=da.option;da.tbody=da.tfoot=da.colgroup=
|
||||
da.caption=da.thead;da.th=da.td;var Oa=S.prototype={ready:function(b){function a(){c||(c=!0,b())}var c=!1;"complete"===X.readyState?setTimeout(a):(this.on("DOMContentLoaded",a),S(W).on("load",a))},toString:function(){var b=[];r(this,function(a){b.push(""+a)});return"["+b.join(", ")+"]"},eq:function(b){return 0<=b?A(this[b]):A(this[this.length+b])},length:0,push:Pe,sort:[].sort,splice:[].splice},rb={};r("multiple selected checked disabled readOnly required open".split(" "),function(b){rb[x(b)]=b});
|
||||
var pc={};r("input select option textarea button form details".split(" "),function(b){pc[La(b)]=!0});r({data:Mb,removeData:Lb},function(b,a){S[a]=b});r({data:Mb,inheritedData:qb,scope:function(b){return A.data(b,"$scope")||qb(b.parentNode||b,["$isolateScope","$scope"])},isolateScope:function(b){return A.data(b,"$isolateScope")||A.data(b,"$isolateScopeNoTemplate")},controller:mc,injector:function(b){return qb(b,"$injector")},removeAttr:function(b,a){b.removeAttribute(a)},hasClass:Nb,css:function(b,
|
||||
a,c){a=ab(a);if(D(c))b.style[a]=c;else{var d;8>=R&&(d=b.currentStyle&&b.currentStyle[a],""===d&&(d="auto"));d=d||b.style[a];8>=R&&(d=""===d?u:d);return d}},attr:function(b,a,c){var d=x(a);if(rb[d])if(D(c))c?(b[a]=!0,b.setAttribute(a,d)):(b[a]=!1,b.removeAttribute(d));else return b[a]||(b.attributes.getNamedItem(a)||v).specified?d:u;else if(D(c))b.setAttribute(a,c);else if(b.getAttribute)return b=b.getAttribute(a,2),null===b?u:b},prop:function(b,a,c){if(D(c))b[a]=c;else return b[a]},text:function(){function b(b,
|
||||
d){var e=a[b.nodeType];if(F(d))return e?b[e]:"";b[e]=d}var a=[];9>R?(a[1]="innerText",a[3]="nodeValue"):a[1]=a[3]="textContent";b.$dv="";return b}(),val:function(b,a){if(F(a)){if("SELECT"===Pa(b)&&b.multiple){var c=[];r(b.options,function(a){a.selected&&c.push(a.value||a.text)});return 0===c.length?null:c}return b.value}b.value=a},html:function(b,a){if(F(a))return b.innerHTML;for(var c=0,d=b.childNodes;c<d.length;c++)Ma(d[c]);b.innerHTML=a},empty:nc},function(b,a){S.prototype[a]=function(a,d){var e,
|
||||
f,g=this.length;if(b!==nc&&(2==b.length&&b!==Nb&&b!==mc?a:d)===u){if(T(a)){for(e=0;e<g;e++)if(b===Mb)b(this[e],a);else for(f in a)b(this[e],f,a[f]);return this}e=b.$dv;g=e===u?Math.min(g,1):g;for(f=0;f<g;f++){var h=b(this[f],a,d);e=e?e+h:h}return e}for(e=0;e<g;e++)b(this[e],a,d);return this}});r({removeData:Lb,dealoc:Ma,on:function a(c,d,e,f){if(D(f))throw Hb("onargs");var g=pa(c,"events"),h=pa(c,"handle");g||pa(c,"events",g={});h||pa(c,"handle",h=ne(c,g));r(d.split(" "),function(d){var f=g[d];if(!f){if("mouseenter"==
|
||||
d||"mouseleave"==d){var l=X.body.contains||X.body.compareDocumentPosition?function(a,c){var d=9===a.nodeType?a.documentElement:a,e=c&&c.parentNode;return a===e||!!(e&&1===e.nodeType&&(d.contains?d.contains(e):a.compareDocumentPosition&&a.compareDocumentPosition(e)&16))}:function(a,c){if(c)for(;c=c.parentNode;)if(c===a)return!0;return!1};g[d]=[];a(c,{mouseleave:"mouseout",mouseenter:"mouseover"}[d],function(a){var c=a.relatedTarget;c&&(c===this||l(this,c))||h(a,d)})}else sb(c,d,h),g[d]=[];f=g[d]}f.push(e)})},
|
||||
off:lc,one:function(a,c,d){a=A(a);a.on(c,function f(){a.off(c,d);a.off(c,f)});a.on(c,d)},replaceWith:function(a,c){var d,e=a.parentNode;Ma(a);r(new S(c),function(c){d?e.insertBefore(c,d.nextSibling):e.replaceChild(c,a);d=c})},children:function(a){var c=[];r(a.childNodes,function(a){1===a.nodeType&&c.push(a)});return c},contents:function(a){return a.contentDocument||a.childNodes||[]},append:function(a,c){r(new S(c),function(c){1!==a.nodeType&&11!==a.nodeType||a.appendChild(c)})},prepend:function(a,
|
||||
c){if(1===a.nodeType){var d=a.firstChild;r(new S(c),function(c){a.insertBefore(c,d)})}},wrap:function(a,c){c=A(c)[0];var d=a.parentNode;d&&d.replaceChild(c,a);c.appendChild(a)},remove:function(a){Ma(a);var c=a.parentNode;c&&c.removeChild(a)},after:function(a,c){var d=a,e=a.parentNode;r(new S(c),function(a){e.insertBefore(a,d.nextSibling);d=a})},addClass:pb,removeClass:ob,toggleClass:function(a,c,d){c&&r(c.split(" "),function(c){var f=d;F(f)&&(f=!Nb(a,c));(f?pb:ob)(a,c)})},parent:function(a){return(a=
|
||||
a.parentNode)&&11!==a.nodeType?a:null},next:function(a){if(a.nextElementSibling)return a.nextElementSibling;for(a=a.nextSibling;null!=a&&1!==a.nodeType;)a=a.nextSibling;return a},find:function(a,c){return a.getElementsByTagName?a.getElementsByTagName(c):[]},clone:Kb,triggerHandler:function(a,c,d){var e,f;e=c.type||c;var g=(pa(a,"events")||{})[e];g&&(e={preventDefault:function(){this.defaultPrevented=!0},isDefaultPrevented:function(){return!0===this.defaultPrevented},stopPropagation:v,type:e,target:a},
|
||||
c.type&&(e=E(e,c)),c=ha(g),f=d?[e].concat(d):[e],r(c,function(c){c.apply(a,f)}))}},function(a,c){S.prototype[c]=function(c,e,f){for(var g,h=0;h<this.length;h++)F(g)?(g=a(this[h],c,e,f),D(g)&&(g=A(g))):Jb(g,a(this[h],c,e,f));return D(g)?g:this};S.prototype.bind=S.prototype.on;S.prototype.unbind=S.prototype.off});db.prototype={put:function(a,c){this[Na(a,this.nextUid)]=c},get:function(a){return this[Na(a,this.nextUid)]},remove:function(a){var c=this[a=Na(a,this.nextUid)];delete this[a];return c}};var pe=
|
||||
/^function\s*[^\(]*\(\s*([^\)]*)\)/m,qe=/,/,re=/^\s*(_?)(\S+?)\1\s*$/,oe=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg,eb=z("$injector"),Qe=z("$animate"),Ld=["$provide",function(a){this.$$selectors={};this.register=function(c,d){var e=c+"-animation";if(c&&"."!=c.charAt(0))throw Qe("notcsel",c);this.$$selectors[c.substr(1)]=e;a.factory(e,d)};this.classNameFilter=function(a){1===arguments.length&&(this.$$classNameFilter=a instanceof RegExp?a:null);return this.$$classNameFilter};this.$get=["$timeout","$$asyncCallback",
|
||||
function(a,d){return{enter:function(a,c,g,h){g?g.after(a):(c&&c[0]||(c=g.parent()),c.append(a));h&&d(h)},leave:function(a,c){a.remove();c&&d(c)},move:function(a,c,d,h){this.enter(a,c,d,h)},addClass:function(a,c,g){c=G(c)?c:L(c)?c.join(" "):"";r(a,function(a){pb(a,c)});g&&d(g)},removeClass:function(a,c,g){c=G(c)?c:L(c)?c.join(" "):"";r(a,function(a){ob(a,c)});g&&d(g)},setClass:function(a,c,g,h){r(a,function(a){pb(a,c);ob(a,g)});h&&d(h)},enabled:v}}]}],ja=z("$compile");gc.$inject=["$provide","$$sanitizeUriProvider"];
|
||||
var we=/^(x[\:\-_]|data[\:\-_])/i,wc=z("$interpolate"),Re=/^([^\?#]*)(\?([^#]*))?(#(.*))?$/,ze={http:80,https:443,ftp:21},Sb=z("$location");Ac.prototype=Tb.prototype=zc.prototype={$$html5:!1,$$replace:!1,absUrl:tb("$$absUrl"),url:function(a){if(F(a))return this.$$url;a=Re.exec(a);a[1]&&this.path(decodeURIComponent(a[1]));(a[2]||a[1])&&this.search(a[3]||"");this.hash(a[5]||"");return this},protocol:tb("$$protocol"),host:tb("$$host"),port:tb("$$port"),path:Bc("$$path",function(a){a=null!==a?a.toString():
|
||||
"";return"/"==a.charAt(0)?a:"/"+a}),search:function(a,c){switch(arguments.length){case 0:return this.$$search;case 1:if(G(a)||jb(a))a=a.toString(),this.$$search=cc(a);else if(T(a))r(a,function(c,e){null==c&&delete a[e]}),this.$$search=a;else throw Sb("isrcharg");break;default:F(c)||null===c?delete this.$$search[a]:this.$$search[a]=c}this.$$compose();return this},hash:Bc("$$hash",function(a){return null!==a?a.toString():""}),replace:function(){this.$$replace=!0;return this}};var la=z("$parse"),Ec=
|
||||
{},ya,Se=Function.prototype.call,Te=Function.prototype.apply,Pc=Function.prototype.bind,hb={"null":function(){return null},"true":function(){return!0},"false":function(){return!1},undefined:v,"+":function(a,c,d,e){d=d(a,c);e=e(a,c);return D(d)?D(e)?d+e:d:D(e)?e:u},"-":function(a,c,d,e){d=d(a,c);e=e(a,c);return(D(d)?d:0)-(D(e)?e:0)},"*":function(a,c,d,e){return d(a,c)*e(a,c)},"/":function(a,c,d,e){return d(a,c)/e(a,c)},"%":function(a,c,d,e){return d(a,c)%e(a,c)},"^":function(a,c,d,e){return d(a,c)^
|
||||
e(a,c)},"=":v,"===":function(a,c,d,e){return d(a,c)===e(a,c)},"!==":function(a,c,d,e){return d(a,c)!==e(a,c)},"==":function(a,c,d,e){return d(a,c)==e(a,c)},"!=":function(a,c,d,e){return d(a,c)!=e(a,c)},"<":function(a,c,d,e){return d(a,c)<e(a,c)},">":function(a,c,d,e){return d(a,c)>e(a,c)},"<=":function(a,c,d,e){return d(a,c)<=e(a,c)},">=":function(a,c,d,e){return d(a,c)>=e(a,c)},"&&":function(a,c,d,e){return d(a,c)&&e(a,c)},"||":function(a,c,d,e){return d(a,c)||e(a,c)},"&":function(a,c,d,e){return d(a,
|
||||
c)&e(a,c)},"|":function(a,c,d,e){return e(a,c)(a,c,d(a,c))},"!":function(a,c,d){return!d(a,c)}},Ue={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},Ub=function(a){this.options=a};Ub.prototype={constructor:Ub,lex:function(a){this.text=a;this.index=0;this.ch=u;this.lastCh=":";for(this.tokens=[];this.index<this.text.length;){this.ch=this.text.charAt(this.index);if(this.is("\"'"))this.readString(this.ch);else if(this.isNumber(this.ch)||this.is(".")&&this.isNumber(this.peek()))this.readNumber();else if(this.isIdent(this.ch))this.readIdent();
|
||||
else if(this.is("(){}[].,;:?"))this.tokens.push({index:this.index,text:this.ch}),this.index++;else if(this.isWhitespace(this.ch)){this.index++;continue}else{a=this.ch+this.peek();var c=a+this.peek(2),d=hb[this.ch],e=hb[a],f=hb[c];f?(this.tokens.push({index:this.index,text:c,fn:f}),this.index+=3):e?(this.tokens.push({index:this.index,text:a,fn:e}),this.index+=2):d?(this.tokens.push({index:this.index,text:this.ch,fn:d}),this.index+=1):this.throwError("Unexpected next character ",this.index,this.index+
|
||||
1)}this.lastCh=this.ch}return this.tokens},is:function(a){return-1!==a.indexOf(this.ch)},was:function(a){return-1!==a.indexOf(this.lastCh)},peek:function(a){a=a||1;return this.index+a<this.text.length?this.text.charAt(this.index+a):!1},isNumber:function(a){return"0"<=a&&"9">=a},isWhitespace:function(a){return" "===a||"\r"===a||"\t"===a||"\n"===a||"\v"===a||"\u00a0"===a},isIdent:function(a){return"a"<=a&&"z">=a||"A"<=a&&"Z">=a||"_"===a||"$"===a},isExpOperator:function(a){return"-"===a||"+"===a||this.isNumber(a)},
|
||||
throwError:function(a,c,d){d=d||this.index;c=D(c)?"s "+c+"-"+this.index+" ["+this.text.substring(c,d)+"]":" "+d;throw la("lexerr",a,c,this.text);},readNumber:function(){for(var a="",c=this.index;this.index<this.text.length;){var d=x(this.text.charAt(this.index));if("."==d||this.isNumber(d))a+=d;else{var e=this.peek();if("e"==d&&this.isExpOperator(e))a+=d;else if(this.isExpOperator(d)&&e&&this.isNumber(e)&&"e"==a.charAt(a.length-1))a+=d;else if(!this.isExpOperator(d)||e&&this.isNumber(e)||"e"!=a.charAt(a.length-
|
||||
1))break;else this.throwError("Invalid exponent")}this.index++}a*=1;this.tokens.push({index:c,text:a,literal:!0,constant:!0,fn:function(){return a}})},readIdent:function(){for(var a=this,c="",d=this.index,e,f,g,h;this.index<this.text.length;){h=this.text.charAt(this.index);if("."===h||this.isIdent(h)||this.isNumber(h))"."===h&&(e=this.index),c+=h;else break;this.index++}if(e)for(f=this.index;f<this.text.length;){h=this.text.charAt(f);if("("===h){g=c.substr(e-d+1);c=c.substr(0,e-d);this.index=f;break}if(this.isWhitespace(h))f++;
|
||||
else break}d={index:d,text:c};if(hb.hasOwnProperty(c))d.fn=hb[c],d.literal=!0,d.constant=!0;else{var k=Dc(c,this.options,this.text);d.fn=E(function(a,c){return k(a,c)},{assign:function(d,e){return ub(d,c,e,a.text,a.options)}})}this.tokens.push(d);g&&(this.tokens.push({index:e,text:"."}),this.tokens.push({index:e+1,text:g}))},readString:function(a){var c=this.index;this.index++;for(var d="",e=a,f=!1;this.index<this.text.length;){var g=this.text.charAt(this.index),e=e+g;if(f)"u"===g?(f=this.text.substring(this.index+
|
||||
1,this.index+5),f.match(/[\da-f]{4}/i)||this.throwError("Invalid unicode escape [\\u"+f+"]"),this.index+=4,d+=String.fromCharCode(parseInt(f,16))):d+=Ue[g]||g,f=!1;else if("\\"===g)f=!0;else{if(g===a){this.index++;this.tokens.push({index:c,text:e,string:d,literal:!0,constant:!0,fn:function(){return d}});return}d+=g}this.index++}this.throwError("Unterminated quote",c)}};var gb=function(a,c,d){this.lexer=a;this.$filter=c;this.options=d};gb.ZERO=E(function(){return 0},{constant:!0});gb.prototype={constructor:gb,
|
||||
parse:function(a){this.text=a;this.tokens=this.lexer.lex(a);a=this.statements();0!==this.tokens.length&&this.throwError("is an unexpected token",this.tokens[0]);a.literal=!!a.literal;a.constant=!!a.constant;return a},primary:function(){var a;if(this.expect("("))a=this.filterChain(),this.consume(")");else if(this.expect("["))a=this.arrayDeclaration();else if(this.expect("{"))a=this.object();else{var c=this.expect();(a=c.fn)||this.throwError("not a primary expression",c);a.literal=!!c.literal;a.constant=
|
||||
!!c.constant}for(var d;c=this.expect("(","[",".");)"("===c.text?(a=this.functionCall(a,d),d=null):"["===c.text?(d=a,a=this.objectIndex(a)):"."===c.text?(d=a,a=this.fieldAccess(a)):this.throwError("IMPOSSIBLE");return a},throwError:function(a,c){throw la("syntax",c.text,a,c.index+1,this.text,this.text.substring(c.index));},peekToken:function(){if(0===this.tokens.length)throw la("ueoe",this.text);return this.tokens[0]},peek:function(a,c,d,e){if(0<this.tokens.length){var f=this.tokens[0],g=f.text;if(g===
|
||||
a||g===c||g===d||g===e||!(a||c||d||e))return f}return!1},expect:function(a,c,d,e){return(a=this.peek(a,c,d,e))?(this.tokens.shift(),a):!1},consume:function(a){this.expect(a)||this.throwError("is unexpected, expecting ["+a+"]",this.peek())},unaryFn:function(a,c){return E(function(d,e){return a(d,e,c)},{constant:c.constant})},ternaryFn:function(a,c,d){return E(function(e,f){return a(e,f)?c(e,f):d(e,f)},{constant:a.constant&&c.constant&&d.constant})},binaryFn:function(a,c,d){return E(function(e,f){return c(e,
|
||||
f,a,d)},{constant:a.constant&&d.constant})},statements:function(){for(var a=[];;)if(0<this.tokens.length&&!this.peek("}",")",";","]")&&a.push(this.filterChain()),!this.expect(";"))return 1===a.length?a[0]:function(c,d){for(var e,f=0;f<a.length;f++){var g=a[f];g&&(e=g(c,d))}return e}},filterChain:function(){for(var a=this.expression(),c;;)if(c=this.expect("|"))a=this.binaryFn(a,c.fn,this.filter());else return a},filter:function(){for(var a=this.expect(),c=this.$filter(a.text),d=[];;)if(a=this.expect(":"))d.push(this.expression());
|
||||
else{var e=function(a,e,h){h=[h];for(var k=0;k<d.length;k++)h.push(d[k](a,e));return c.apply(a,h)};return function(){return e}}},expression:function(){return this.assignment()},assignment:function(){var a=this.ternary(),c,d;return(d=this.expect("="))?(a.assign||this.throwError("implies assignment but ["+this.text.substring(0,d.index)+"] can not be assigned to",d),c=this.ternary(),function(d,f){return a.assign(d,c(d,f),f)}):a},ternary:function(){var a=this.logicalOR(),c,d;if(this.expect("?")){c=this.assignment();
|
||||
if(d=this.expect(":"))return this.ternaryFn(a,c,this.assignment());this.throwError("expected :",d)}else return a},logicalOR:function(){for(var a=this.logicalAND(),c;;)if(c=this.expect("||"))a=this.binaryFn(a,c.fn,this.logicalAND());else return a},logicalAND:function(){var a=this.equality(),c;if(c=this.expect("&&"))a=this.binaryFn(a,c.fn,this.logicalAND());return a},equality:function(){var a=this.relational(),c;if(c=this.expect("==","!=","===","!=="))a=this.binaryFn(a,c.fn,this.equality());return a},
|
||||
relational:function(){var a=this.additive(),c;if(c=this.expect("<",">","<=",">="))a=this.binaryFn(a,c.fn,this.relational());return a},additive:function(){for(var a=this.multiplicative(),c;c=this.expect("+","-");)a=this.binaryFn(a,c.fn,this.multiplicative());return a},multiplicative:function(){for(var a=this.unary(),c;c=this.expect("*","/","%");)a=this.binaryFn(a,c.fn,this.unary());return a},unary:function(){var a;return this.expect("+")?this.primary():(a=this.expect("-"))?this.binaryFn(gb.ZERO,a.fn,
|
||||
this.unary()):(a=this.expect("!"))?this.unaryFn(a.fn,this.unary()):this.primary()},fieldAccess:function(a){var c=this,d=this.expect().text,e=Dc(d,this.options,this.text);return E(function(c,d,h){return e(h||a(c,d))},{assign:function(e,g,h){(h=a(e,h))||a.assign(e,h={});return ub(h,d,g,c.text,c.options)}})},objectIndex:function(a){var c=this,d=this.expression();this.consume("]");return E(function(e,f){var g=a(e,f),h=d(e,f),k;ka(h,c.text);if(!g)return u;(g=ma(g[h],c.text))&&(g.then&&c.options.unwrapPromises)&&
|
||||
(k=g,"$$v"in g||(k.$$v=u,k.then(function(a){k.$$v=a})),g=g.$$v);return g},{assign:function(e,f,g){var h=ka(d(e,g),c.text);(g=ma(a(e,g),c.text))||a.assign(e,g={});return g[h]=f}})},functionCall:function(a,c){var d=[];if(")"!==this.peekToken().text){do d.push(this.expression());while(this.expect(","))}this.consume(")");var e=this;return function(f,g){for(var h=[],k=c?c(f,g):f,m=0;m<d.length;m++)h.push(ma(d[m](f,g),e.text));m=a(f,g,k)||v;ma(k,e.text);var l=e.text;if(m){if(m.constructor===m)throw la("isecfn",
|
||||
l);if(m===Se||m===Te||Pc&&m===Pc)throw la("isecff",l);}h=m.apply?m.apply(k,h):m(h[0],h[1],h[2],h[3],h[4]);return ma(h,e.text)}},arrayDeclaration:function(){var a=[],c=!0;if("]"!==this.peekToken().text){do{if(this.peek("]"))break;var d=this.expression();a.push(d);d.constant||(c=!1)}while(this.expect(","))}this.consume("]");return E(function(c,d){for(var g=[],h=0;h<a.length;h++)g.push(a[h](c,d));return g},{literal:!0,constant:c})},object:function(){var a=[],c=!0;if("}"!==this.peekToken().text){do{if(this.peek("}"))break;
|
||||
var d=this.expect(),d=d.string||d.text;this.consume(":");var e=this.expression();a.push({key:d,value:e});e.constant||(c=!1)}while(this.expect(","))}this.consume("}");return E(function(c,d){for(var e={},k=0;k<a.length;k++){var m=a[k];e[m.key]=m.value(c,d)}return e},{literal:!0,constant:c})}};var Ce={},Be={},za=z("$sce"),fa={HTML:"html",CSS:"css",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Y=X.createElement("a"),Gc=xa(W.location.href,!0);kc.$inject=["$provide"];Hc.$inject=["$locale"];Jc.$inject=["$locale"];
|
||||
var Mc=".",Me={yyyy:Z("FullYear",4),yy:Z("FullYear",2,0,!0),y:Z("FullYear",1),MMMM:vb("Month"),MMM:vb("Month",!0),MM:Z("Month",2,1),M:Z("Month",1,1),dd:Z("Date",2),d:Z("Date",1),HH:Z("Hours",2),H:Z("Hours",1),hh:Z("Hours",2,-12),h:Z("Hours",1,-12),mm:Z("Minutes",2),m:Z("Minutes",1),ss:Z("Seconds",2),s:Z("Seconds",1),sss:Z("Milliseconds",3),EEEE:vb("Day"),EEE:vb("Day",!0),a:function(a,c){return 12>a.getHours()?c.AMPMS[0]:c.AMPMS[1]},Z:function(a){a=-1*a.getTimezoneOffset();return a=(0<=a?"+":"")+(Vb(Math[0<
|
||||
a?"floor":"ceil"](a/60),2)+Vb(Math.abs(a%60),2))}},Le=/((?:[^yMdHhmsaZE']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|d+|H+|h+|m+|s+|a|Z))(.*)/,Ke=/^\-?\d+$/;Ic.$inject=["$locale"];var Ie=aa(x),Je=aa(La);Kc.$inject=["$parse"];var cd=aa({restrict:"E",compile:function(a,c){8>=R&&(c.href||c.name||c.$set("href",""),a.append(X.createComment("IE fix")));if(!c.href&&!c.xlinkHref&&!c.name)return function(a,c){var f="[object SVGAnimatedString]"===Ba.call(c.prop("href"))?"xlink:href":"href";c.on("click",function(a){c.attr(f)||
|
||||
a.preventDefault()})}}}),Fb={};r(rb,function(a,c){if("multiple"!=a){var d=qa("ng-"+c);Fb[d]=function(){return{priority:100,link:function(a,f,g){a.$watch(g[d],function(a){g.$set(c,!!a)})}}}}});r(["src","srcset","href"],function(a){var c=qa("ng-"+a);Fb[c]=function(){return{priority:99,link:function(d,e,f){var g=a,h=a;"href"===a&&"[object SVGAnimatedString]"===Ba.call(e.prop("href"))&&(h="xlinkHref",f.$attr[h]="xlink:href",g=null);f.$observe(c,function(c){c?(f.$set(h,c),R&&g&&e.prop(g,f[h])):"href"===
|
||||
a&&f.$set(h,null)})}}}});var yb={$addControl:v,$removeControl:v,$setValidity:v,$setDirty:v,$setPristine:v};Nc.$inject=["$element","$attrs","$scope","$animate"];var Qc=function(a){return["$timeout",function(c){return{name:"form",restrict:a?"EAC":"E",controller:Nc,compile:function(){return{pre:function(a,e,f,g){if(!f.action){var h=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1};sb(e[0],"submit",h);e.on("$destroy",function(){c(function(){bb(e[0],"submit",h)},0,!1)})}var k=e.parent().controller("form"),
|
||||
m=f.name||f.ngForm;m&&ub(a,m,g,m);if(k)e.on("$destroy",function(){k.$removeControl(g);m&&ub(a,m,u,m);E(g,yb)})}}}}}]},dd=Qc(),qd=Qc(!0),Ve=/^(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?$/,We=/^[a-z0-9!#$%&'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i,Xe=/^\s*(\-|\+)?(\d+|(\d*(\.\d*)))\s*$/,Rc={text:Ab,number:function(a,c,d,e,f,g){Ab(a,c,d,e,f,g);e.$parsers.push(function(a){var c=e.$isEmpty(a);if(c||Xe.test(a))return e.$setValidity("number",
|
||||
!0),""===a?null:c?a:parseFloat(a);e.$setValidity("number",!1);return u});Ne(e,"number",Ye,null,e.$$validityState);e.$formatters.push(function(a){return e.$isEmpty(a)?"":""+a});d.min&&(a=function(a){var c=parseFloat(d.min);return ua(e,"min",e.$isEmpty(a)||a>=c,a)},e.$parsers.push(a),e.$formatters.push(a));d.max&&(a=function(a){var c=parseFloat(d.max);return ua(e,"max",e.$isEmpty(a)||a<=c,a)},e.$parsers.push(a),e.$formatters.push(a));e.$formatters.push(function(a){return ua(e,"number",e.$isEmpty(a)||
|
||||
jb(a),a)})},url:function(a,c,d,e,f,g){Ab(a,c,d,e,f,g);a=function(a){return ua(e,"url",e.$isEmpty(a)||Ve.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},email:function(a,c,d,e,f,g){Ab(a,c,d,e,f,g);a=function(a){return ua(e,"email",e.$isEmpty(a)||We.test(a),a)};e.$formatters.push(a);e.$parsers.push(a)},radio:function(a,c,d,e){F(d.name)&&c.attr("name",ib());c.on("click",function(){c[0].checked&&a.$apply(function(){e.$setViewValue(d.value)})});e.$render=function(){c[0].checked=d.value==e.$viewValue};
|
||||
d.$observe("value",e.$render)},checkbox:function(a,c,d,e){var f=d.ngTrueValue,g=d.ngFalseValue;G(f)||(f=!0);G(g)||(g=!1);c.on("click",function(){a.$apply(function(){e.$setViewValue(c[0].checked)})});e.$render=function(){c[0].checked=e.$viewValue};e.$isEmpty=function(a){return a!==f};e.$formatters.push(function(a){return a===f});e.$parsers.push(function(a){return a?f:g})},hidden:v,button:v,submit:v,reset:v,file:v},Ye=["badInput"],hc=["$browser","$sniffer",function(a,c){return{restrict:"E",require:"?ngModel",
|
||||
link:function(d,e,f,g){g&&(Rc[x(f.type)]||Rc.text)(d,e,f,g,c,a)}}}],wb="ng-valid",xb="ng-invalid",Ra="ng-pristine",zb="ng-dirty",Ze=["$scope","$exceptionHandler","$attrs","$element","$parse","$animate",function(a,c,d,e,f,g){function h(a,c){c=c?"-"+nb(c,"-"):"";g.removeClass(e,(a?xb:wb)+c);g.addClass(e,(a?wb:xb)+c)}this.$modelValue=this.$viewValue=Number.NaN;this.$parsers=[];this.$formatters=[];this.$viewChangeListeners=[];this.$pristine=!0;this.$dirty=!1;this.$valid=!0;this.$invalid=!1;this.$name=
|
||||
d.name;var k=f(d.ngModel),m=k.assign;if(!m)throw z("ngModel")("nonassign",d.ngModel,ia(e));this.$render=v;this.$isEmpty=function(a){return F(a)||""===a||null===a||a!==a};var l=e.inheritedData("$formController")||yb,n=0,q=this.$error={};e.addClass(Ra);h(!0);this.$setValidity=function(a,c){q[a]!==!c&&(c?(q[a]&&n--,n||(h(!0),this.$valid=!0,this.$invalid=!1)):(h(!1),this.$invalid=!0,this.$valid=!1,n++),q[a]=!c,h(c,a),l.$setValidity(a,c,this))};this.$setPristine=function(){this.$dirty=!1;this.$pristine=
|
||||
!0;g.removeClass(e,zb);g.addClass(e,Ra)};this.$setViewValue=function(d){this.$viewValue=d;this.$pristine&&(this.$dirty=!0,this.$pristine=!1,g.removeClass(e,Ra),g.addClass(e,zb),l.$setDirty());r(this.$parsers,function(a){d=a(d)});this.$modelValue!==d&&(this.$modelValue=d,m(a,d),r(this.$viewChangeListeners,function(a){try{a()}catch(d){c(d)}}))};var p=this;a.$watch(function(){var c=k(a);if(p.$modelValue!==c){var d=p.$formatters,e=d.length;for(p.$modelValue=c;e--;)c=d[e](c);p.$viewValue!==c&&(p.$viewValue=
|
||||
c,p.$render())}return c})}],Fd=function(){return{require:["ngModel","^?form"],controller:Ze,link:function(a,c,d,e){var f=e[0],g=e[1]||yb;g.$addControl(f);a.$on("$destroy",function(){g.$removeControl(f)})}}},Hd=aa({require:"ngModel",link:function(a,c,d,e){e.$viewChangeListeners.push(function(){a.$eval(d.ngChange)})}}),ic=function(){return{require:"?ngModel",link:function(a,c,d,e){if(e){d.required=!0;var f=function(a){if(d.required&&e.$isEmpty(a))e.$setValidity("required",!1);else return e.$setValidity("required",
|
||||
!0),a};e.$formatters.push(f);e.$parsers.unshift(f);d.$observe("required",function(){f(e.$viewValue)})}}}},Gd=function(){return{require:"ngModel",link:function(a,c,d,e){var f=(a=/\/(.*)\//.exec(d.ngList))&&RegExp(a[1])||d.ngList||",";e.$parsers.push(function(a){if(!F(a)){var c=[];a&&r(a.split(f),function(a){a&&c.push($(a))});return c}});e.$formatters.push(function(a){return L(a)?a.join(", "):u});e.$isEmpty=function(a){return!a||!a.length}}}},$e=/^(true|false|\d+)$/,Id=function(){return{priority:100,
|
||||
compile:function(a,c){return $e.test(c.ngValue)?function(a,c,f){f.$set("value",a.$eval(f.ngValue))}:function(a,c,f){a.$watch(f.ngValue,function(a){f.$set("value",a)})}}}},id=Aa({compile:function(a){a.addClass("ng-binding");return function(a,d,e){d.data("$binding",e.ngBind);a.$watch(e.ngBind,function(a){d.text(a==u?"":a)})}}}),kd=["$interpolate",function(a){return function(c,d,e){c=a(d.attr(e.$attr.ngBindTemplate));d.addClass("ng-binding").data("$binding",c);e.$observe("ngBindTemplate",function(a){d.text(a)})}}],
|
||||
jd=["$sce","$parse",function(a,c){return{compile:function(d){d.addClass("ng-binding");return function(d,f,g){f.data("$binding",g.ngBindHtml);var h=c(g.ngBindHtml);d.$watch(function(){return(h(d)||"").toString()},function(c){f.html(a.getTrustedHtml(h(d))||"")})}}}}],ld=Wb("",!0),nd=Wb("Odd",0),md=Wb("Even",1),od=Aa({compile:function(a,c){c.$set("ngCloak",u);a.removeClass("ng-cloak")}}),pd=[function(){return{scope:!0,controller:"@",priority:500}}],jc={},af={blur:!0,focus:!0};r("click dblclick mousedown mouseup mouseover mouseout mousemove mouseenter mouseleave keydown keyup keypress submit focus blur copy cut paste".split(" "),
|
||||
function(a){var c=qa("ng-"+a);jc[c]=["$parse","$rootScope",function(d,e){return{compile:function(f,g){var h=d(g[c],!0);return function(c,d){d.on(a,function(d){var f=function(){h(c,{$event:d})};af[a]&&e.$$phase?c.$evalAsync(f):c.$apply(f)})}}}}]});var sd=["$animate",function(a){return{transclude:"element",priority:600,terminal:!0,restrict:"A",$$tlb:!0,link:function(c,d,e,f,g){var h,k,m;c.$watch(e.ngIf,function(f){Wa(f)?k||(k=c.$new(),g(k,function(c){c[c.length++]=X.createComment(" end ngIf: "+e.ngIf+
|
||||
" ");h={clone:c};a.enter(c,d.parent(),d)})):(m&&(m.remove(),m=null),k&&(k.$destroy(),k=null),h&&(m=Eb(h.clone),a.leave(m,function(){m=null}),h=null))})}}}],td=["$http","$templateCache","$anchorScroll","$animate","$sce",function(a,c,d,e,f){return{restrict:"ECA",priority:400,terminal:!0,transclude:"element",controller:Xa.noop,compile:function(g,h){var k=h.ngInclude||h.src,m=h.onload||"",l=h.autoscroll;return function(g,h,p,r,J){var w=0,t,y,u,B=function(){y&&(y.remove(),y=null);t&&(t.$destroy(),t=null);
|
||||
u&&(e.leave(u,function(){y=null}),y=u,u=null)};g.$watch(f.parseAsResourceUrl(k),function(f){var k=function(){!D(l)||l&&!g.$eval(l)||d()},p=++w;f?(a.get(f,{cache:c}).success(function(a){if(p===w){var c=g.$new();r.template=a;a=J(c,function(a){B();e.enter(a,null,h,k)});t=c;u=a;t.$emit("$includeContentLoaded");g.$eval(m)}}).error(function(){p===w&&B()}),g.$emit("$includeContentRequested")):(B(),r.template=null)})}}}}],Jd=["$compile",function(a){return{restrict:"ECA",priority:-400,require:"ngInclude",
|
||||
link:function(c,d,e,f){d.html(f.template);a(d.contents())(c)}}}],ud=Aa({priority:450,compile:function(){return{pre:function(a,c,d){a.$eval(d.ngInit)}}}}),vd=Aa({terminal:!0,priority:1E3}),wd=["$locale","$interpolate",function(a,c){var d=/{}/g;return{restrict:"EA",link:function(e,f,g){var h=g.count,k=g.$attr.when&&f.attr(g.$attr.when),m=g.offset||0,l=e.$eval(k)||{},n={},q=c.startSymbol(),p=c.endSymbol(),s=/^when(Minus)?(.+)$/;r(g,function(a,c){s.test(c)&&(l[x(c.replace("when","").replace("Minus","-"))]=
|
||||
f.attr(g.$attr[c]))});r(l,function(a,e){n[e]=c(a.replace(d,q+h+"-"+m+p))});e.$watch(function(){var c=parseFloat(e.$eval(h));if(isNaN(c))return"";c in l||(c=a.pluralCat(c-m));return n[c](e,f,!0)},function(a){f.text(a)})}}}],xd=["$parse","$animate",function(a,c){var d=z("ngRepeat");return{transclude:"element",priority:1E3,terminal:!0,$$tlb:!0,link:function(e,f,g,h,k){var m=g.ngRepeat,l=m.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?\s*$/),n,q,p,s,u,w,t={$id:Na};if(!l)throw d("iexp",
|
||||
m);g=l[1];h=l[2];(l=l[3])?(n=a(l),q=function(a,c,d){w&&(t[w]=a);t[u]=c;t.$index=d;return n(e,t)}):(p=function(a,c){return Na(c)},s=function(a){return a});l=g.match(/^(?:([\$\w]+)|\(([\$\w]+)\s*,\s*([\$\w]+)\))$/);if(!l)throw d("iidexp",g);u=l[3]||l[1];w=l[2];var y={};e.$watchCollection(h,function(a){var g,h,l=f[0],n,t={},D,C,I,x,G,v,z,F=[];if(Sa(a))v=a,G=q||p;else{G=q||s;v=[];for(I in a)a.hasOwnProperty(I)&&"$"!=I.charAt(0)&&v.push(I);v.sort()}D=v.length;h=F.length=v.length;for(g=0;g<h;g++)if(I=a===
|
||||
v?g:v[g],x=a[I],n=G(I,x,g),Ea(n,"`track by` id"),y.hasOwnProperty(n))z=y[n],delete y[n],t[n]=z,F[g]=z;else{if(t.hasOwnProperty(n))throw r(F,function(a){a&&a.scope&&(y[a.id]=a)}),d("dupes",m,n,oa(x));F[g]={id:n};t[n]=!1}for(I in y)y.hasOwnProperty(I)&&(z=y[I],g=Eb(z.clone),c.leave(g),r(g,function(a){a.$$NG_REMOVED=!0}),z.scope.$destroy());g=0;for(h=v.length;g<h;g++){I=a===v?g:v[g];x=a[I];z=F[g];F[g-1]&&(l=F[g-1].clone[F[g-1].clone.length-1]);if(z.scope){C=z.scope;n=l;do n=n.nextSibling;while(n&&n.$$NG_REMOVED);
|
||||
z.clone[0]!=n&&c.move(Eb(z.clone),null,A(l));l=z.clone[z.clone.length-1]}else C=e.$new();C[u]=x;w&&(C[w]=I);C.$index=g;C.$first=0===g;C.$last=g===D-1;C.$middle=!(C.$first||C.$last);C.$odd=!(C.$even=0===(g&1));z.scope||k(C,function(a){a[a.length++]=X.createComment(" end ngRepeat: "+m+" ");c.enter(a,null,A(l));l=a;z.scope=C;z.clone=a;t[z.id]=z})}y=t})}}}],yd=["$animate",function(a){return function(c,d,e){c.$watch(e.ngShow,function(c){a[Wa(c)?"removeClass":"addClass"](d,"ng-hide")})}}],rd=["$animate",
|
||||
function(a){return function(c,d,e){c.$watch(e.ngHide,function(c){a[Wa(c)?"addClass":"removeClass"](d,"ng-hide")})}}],zd=Aa(function(a,c,d){a.$watch(d.ngStyle,function(a,d){d&&a!==d&&r(d,function(a,d){c.css(d,"")});a&&c.css(a)},!0)}),Ad=["$animate",function(a){return{restrict:"EA",require:"ngSwitch",controller:["$scope",function(){this.cases={}}],link:function(c,d,e,f){var g=[],h=[],k=[],m=[];c.$watch(e.ngSwitch||e.on,function(d){var n,q;n=0;for(q=k.length;n<q;++n)k[n].remove();n=k.length=0;for(q=
|
||||
m.length;n<q;++n){var p=h[n];m[n].$destroy();k[n]=p;a.leave(p,function(){k.splice(n,1)})}h.length=0;m.length=0;if(g=f.cases["!"+d]||f.cases["?"])c.$eval(e.change),r(g,function(d){var e=c.$new();m.push(e);d.transclude(e,function(c){var e=d.element;h.push(c);a.enter(c,e.parent(),e)})})})}}}],Bd=Aa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,f){e.cases["!"+d.ngSwitchWhen]=e.cases["!"+d.ngSwitchWhen]||[];e.cases["!"+d.ngSwitchWhen].push({transclude:f,element:c})}}),Cd=
|
||||
Aa({transclude:"element",priority:800,require:"^ngSwitch",link:function(a,c,d,e,f){e.cases["?"]=e.cases["?"]||[];e.cases["?"].push({transclude:f,element:c})}}),Ed=Aa({link:function(a,c,d,e,f){if(!f)throw z("ngTransclude")("orphan",ia(c));f(function(a){c.empty();c.append(a)})}}),ed=["$templateCache",function(a){return{restrict:"E",terminal:!0,compile:function(c,d){"text/ng-template"==d.type&&a.put(d.id,c[0].text)}}}],bf=z("ngOptions"),Dd=aa({terminal:!0}),fd=["$compile","$parse",function(a,c){var d=
|
||||
/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?\s+for\s+(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,e={$setViewValue:v};return{restrict:"E",require:["select","?ngModel"],controller:["$element","$scope","$attrs",function(a,c,d){var k=this,m={},l=e,n;k.databound=d.ngModel;k.init=function(a,c,d){l=a;n=d};k.addOption=function(c){Ea(c,'"option value"');m[c]=!0;l.$viewValue==c&&(a.val(c),n.parent()&&n.remove())};
|
||||
k.removeOption=function(a){this.hasOption(a)&&(delete m[a],l.$viewValue==a&&this.renderUnknownOption(a))};k.renderUnknownOption=function(c){c="? "+Na(c)+" ?";n.val(c);a.prepend(n);a.val(c);n.prop("selected",!0)};k.hasOption=function(a){return m.hasOwnProperty(a)};c.$on("$destroy",function(){k.renderUnknownOption=v})}],link:function(e,g,h,k){function m(a,c,d,e){d.$render=function(){var a=d.$viewValue;e.hasOption(a)?(x.parent()&&x.remove(),c.val(a),""===a&&w.prop("selected",!0)):F(a)&&w?c.val(""):e.renderUnknownOption(a)};
|
||||
c.on("change",function(){a.$apply(function(){x.parent()&&x.remove();d.$setViewValue(c.val())})})}function l(a,c,d){var e;d.$render=function(){var a=new db(d.$viewValue);r(c.find("option"),function(c){c.selected=D(a.get(c.value))})};a.$watch(function(){Ca(e,d.$viewValue)||(e=ha(d.$viewValue),d.$render())});c.on("change",function(){a.$apply(function(){var a=[];r(c.find("option"),function(c){c.selected&&a.push(c.value)});d.$setViewValue(a)})})}function n(e,f,g){function h(){var a={"":[]},c=[""],d,k,
|
||||
s,u,v;s=g.$modelValue;u=A(e)||[];var F=n?Xb(u):u,G,Q,C;Q={};C=!1;if(p)if(k=g.$modelValue,w&&L(k))for(C=new db([]),d={},v=0;v<k.length;v++)d[m]=k[v],C.put(w(e,d),k[v]);else C=new db(k);v=C;var E,K;for(C=0;G=F.length,C<G;C++){k=C;if(n){k=F[C];if("$"===k.charAt(0))continue;Q[n]=k}Q[m]=u[k];d=r(e,Q)||"";(k=a[d])||(k=a[d]=[],c.push(d));p?d=D(v.remove(w?w(e,Q):x(e,Q))):(w?(d={},d[m]=s,d=w(e,d)===w(e,Q)):d=s===x(e,Q),v=v||d);E=l(e,Q);E=D(E)?E:"";k.push({id:w?w(e,Q):n?F[C]:C,label:E,selected:d})}p||(z||null===
|
||||
s?a[""].unshift({id:"",label:"",selected:!v}):v||a[""].unshift({id:"?",label:"",selected:!0}));Q=0;for(F=c.length;Q<F;Q++){d=c[Q];k=a[d];B.length<=Q?(s={element:y.clone().attr("label",d),label:k.label},u=[s],B.push(u),f.append(s.element)):(u=B[Q],s=u[0],s.label!=d&&s.element.attr("label",s.label=d));E=null;C=0;for(G=k.length;C<G;C++)d=k[C],(v=u[C+1])?(E=v.element,v.label!==d.label&&(E.text(v.label=d.label),E.prop("label",v.label)),v.id!==d.id&&E.val(v.id=d.id),E[0].selected!==d.selected&&(E.prop("selected",
|
||||
v.selected=d.selected),R&&E.prop("selected",v.selected))):(""===d.id&&z?K=z:(K=t.clone()).val(d.id).prop("selected",d.selected).attr("selected",d.selected).prop("label",d.label).text(d.label),u.push({element:K,label:d.label,id:d.id,selected:d.selected}),q.addOption(d.label,K),E?E.after(K):s.element.append(K),E=K);for(C++;u.length>C;)d=u.pop(),q.removeOption(d.label),d.element.remove()}for(;B.length>Q;)B.pop()[0].element.remove()}var k;if(!(k=s.match(d)))throw bf("iexp",s,ia(f));var l=c(k[2]||k[1]),
|
||||
m=k[4]||k[6],n=k[5],r=c(k[3]||""),x=c(k[2]?k[1]:m),A=c(k[7]),w=k[8]?c(k[8]):null,B=[[{element:f,label:""}]];z&&(a(z)(e),z.removeClass("ng-scope"),z.remove());f.empty();f.on("change",function(){e.$apply(function(){var a,c=A(e)||[],d={},k,l,q,r,s,t,v;if(p)for(l=[],r=0,t=B.length;r<t;r++)for(a=B[r],q=1,s=a.length;q<s;q++){if((k=a[q].element)[0].selected){k=k.val();n&&(d[n]=k);if(w)for(v=0;v<c.length&&(d[m]=c[v],w(e,d)!=k);v++);else d[m]=c[k];l.push(x(e,d))}}else if(k=f.val(),"?"==k)l=u;else if(""===
|
||||
k)l=null;else if(w)for(v=0;v<c.length;v++){if(d[m]=c[v],w(e,d)==k){l=x(e,d);break}}else d[m]=c[k],n&&(d[n]=k),l=x(e,d);g.$setViewValue(l);h()})});g.$render=h;e.$watchCollection(A,h);e.$watchCollection(function(){var a={},c=A(e);if(c){for(var d=Array(c.length),f=0,g=c.length;f<g;f++)a[m]=c[f],d[f]=l(e,a);return d}},h);p&&e.$watchCollection(function(){return g.$modelValue},h)}if(k[1]){var q=k[0];k=k[1];var p=h.multiple,s=h.ngOptions,z=!1,w,t=A(X.createElement("option")),y=A(X.createElement("optgroup")),
|
||||
x=t.clone();h=0;for(var B=g.children(),v=B.length;h<v;h++)if(""===B[h].value){w=z=B.eq(h);break}q.init(k,z,x);p&&(k.$isEmpty=function(a){return!a||0===a.length});s?n(e,g,k):p?l(e,g,k):m(e,g,k,q)}}}}],hd=["$interpolate",function(a){var c={addOption:v,removeOption:v};return{restrict:"E",priority:100,compile:function(d,e){if(F(e.value)){var f=a(d.text(),!0);f||e.$set("value",d.text())}return function(a,d,e){var m=d.parent(),l=m.data("$selectController")||m.parent().data("$selectController");l&&l.databound?
|
||||
d.prop("selected",!1):l=c;f?a.$watch(f,function(a,c){e.$set("value",a);a!==c&&l.removeOption(c);l.addOption(a)}):l.addOption(e.value);d.on("$destroy",function(){l.removeOption(e.value)})}}}}],gd=aa({restrict:"E",terminal:!0});W.angular.bootstrap?console.log("WARNING: Tried to load angular more than once."):((Fa=W.jQuery)&&Fa.fn.on?(A=Fa,E(Fa.fn,{scope:Oa.scope,isolateScope:Oa.isolateScope,controller:Oa.controller,injector:Oa.injector,inheritedData:Oa.inheritedData}),Gb("remove",!0,!0,!1),Gb("empty",
|
||||
!1,!1,!1),Gb("html",!1,!1,!0)):A=S,Xa.element=A,Zc(Xa),A(X).ready(function(){Wc(X,dc)}))})(window,document);!window.angular.$$csp()&&window.angular.element(document).find("head").prepend('<style type="text/css">@charset "UTF-8";[ng\\:cloak],[ng-cloak],[data-ng-cloak],[x-ng-cloak],.ng-cloak,.x-ng-cloak,.ng-hide{display:none !important;}ng\\:form{display:block;}.ng-animate-block-transitions{transition:0s all!important;-webkit-transition:0s all!important;}.ng-hide-add-active,.ng-hide-remove{display:block!important;}</style>');
|
||||
//# sourceMappingURL=angular.min.js.map
|
BIN
bower_components/angular/angular.min.js.gzip
vendored
BIN
bower_components/angular/angular.min.js.gzip
vendored
Binary file not shown.
8
bower_components/angular/angular.min.js.map
vendored
8
bower_components/angular/angular.min.js.map
vendored
File diff suppressed because one or more lines are too long
8
bower_components/angular/bower.json
vendored
8
bower_components/angular/bower.json
vendored
@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "angular",
|
||||
"version": "1.2.28",
|
||||
"main": "./angular.js",
|
||||
"ignore": [],
|
||||
"dependencies": {
|
||||
}
|
||||
}
|
25
bower_components/angular/package.json
vendored
25
bower_components/angular/package.json
vendored
@ -1,25 +0,0 @@
|
||||
{
|
||||
"name": "angular",
|
||||
"version": "1.2.28",
|
||||
"description": "HTML enhanced for web apps",
|
||||
"main": "angular.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/angular/angular.js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"angular",
|
||||
"framework",
|
||||
"browser",
|
||||
"client-side"
|
||||
],
|
||||
"author": "Angular Core Team <angular-core+npm@google.com>",
|
||||
"license": "MIT",
|
||||
"bugs": {
|
||||
"url": "https://github.com/angular/angular.js/issues"
|
||||
},
|
||||
"homepage": "http://angularjs.org"
|
||||
}
|
14
bower_components/jsdom/.bower.json
vendored
14
bower_components/jsdom/.bower.json
vendored
@ -1,14 +0,0 @@
|
||||
{
|
||||
"name": "jsdom",
|
||||
"homepage": "https://github.com/tmpvar/jsdom",
|
||||
"version": "0.10.6",
|
||||
"_release": "0.10.6",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "0.10.6",
|
||||
"commit": "e27bca5eb8ffd51fb50dc24157d0a8421fb08040"
|
||||
},
|
||||
"_source": "git://github.com/tmpvar/jsdom.git",
|
||||
"_target": "0.10.x",
|
||||
"_originalSource": "jsdom"
|
||||
}
|
6
bower_components/jsdom/.gitignore
vendored
6
bower_components/jsdom/.gitignore
vendored
@ -1,6 +0,0 @@
|
||||
.DS_Store
|
||||
.svn
|
||||
.*.swp
|
||||
gmon.out
|
||||
v8.log
|
||||
node_modules
|
14
bower_components/jsdom/.npmignore
vendored
14
bower_components/jsdom/.npmignore
vendored
@ -1,14 +0,0 @@
|
||||
benchmark/
|
||||
example/
|
||||
test/
|
||||
Changelog.md
|
||||
status.json
|
||||
Contributing.md
|
||||
|
||||
.npmignore
|
||||
.DS_Store
|
||||
.svn
|
||||
.travis.yml
|
||||
.*.swp
|
||||
**gmon.out
|
||||
**v8.log
|
4
bower_components/jsdom/.travis.yml
vendored
4
bower_components/jsdom/.travis.yml
vendored
@ -1,4 +0,0 @@
|
||||
language: node_js
|
||||
node_js:
|
||||
- "0.8"
|
||||
- "0.10"
|
433
bower_components/jsdom/Changelog.md
vendored
433
bower_components/jsdom/Changelog.md
vendored
@ -1,433 +0,0 @@
|
||||
## 0.10.6
|
||||
|
||||
* Add: remaining URL properties to `window.location` and `HTMLAnchorElement`.
|
||||
* Fix: the presence of `String.prototype.normalize`, which is available by default in Node 0.11.13 onwards, caused reflected attributes to break. (brock8503)
|
||||
* Fix: iframes now correctly load `about:blank` when the `src` attribute is empty or missing. (mcmathja)
|
||||
* Fix: documents containing only whitespace now correctly generate wrapper documents, just like blank documents do. (nikolas)
|
||||
* Tweak: lazy-load the request module, to improve overall jsdom loading time. (tantaman)
|
||||
|
||||
## 0.10.5
|
||||
|
||||
* Fix: the list of void elements has been updated to match the latest HTML spec.
|
||||
* Fix: when serializing void elements, don't include a ` /`: i.e. the result is now `<br>` instead of `<br />`.
|
||||
|
||||
## 0.10.4
|
||||
|
||||
* Fix: another case was found where jQuery 1.11's `show()` method would cause errors.
|
||||
* Add: `querySelector` and `querySelectorAll` methods to `DocumentFragment`s. (Joris-van-der-Wel)
|
||||
|
||||
## 0.10.3
|
||||
|
||||
* Fix: various defaults on `HTMLAnchorElement` and `window.location` should not be `null`; they should usually be the empty string.
|
||||
|
||||
## 0.10.2
|
||||
|
||||
* Fix: Using jQuery 1.11's `show()` method would cause an error to be thrown.
|
||||
* Fix: `window.location` properties were not updating correctly after using `pushState` or `replaceState`. (toomanydaves)
|
||||
|
||||
## 0.10.1
|
||||
|
||||
* Fix: `window.location.port` should default to `""`, not `null`. (bpeacock)
|
||||
|
||||
## 0.10.0
|
||||
|
||||
* Add: a more complete `document.cookie` implementation, that supports multiple cookies. Note that options like `path`, `max-age`, etc. are still ignored. (dai-shi)
|
||||
|
||||
## 0.9.0
|
||||
|
||||
* Add: implement attribute ordering semantics from WHATWG DOM spec, and in general overhaul attribute storage implementation to be much more awesome and accurate. (lddubeau)
|
||||
* Add: `port` and `protocol` to `HTMLAnchorElement`. (sporchia)
|
||||
* Fix: make `HTMLInputElement` not have a `type` *attribute* by default. It still has a default value for the `type` *property*, viz. `"text"`. (aredridel)
|
||||
* Fix: treat empty namespace URI as meaning "no namespace" with the `getAttributeNS`, `hasAttributeNS`, and `setAttributeNS` functions. (lddubeau)
|
||||
* Fix: reference typed arrays in a way that doesn't immediately break on Node 0.6. Node 0.6 isn't supported in general, though. (kangax)
|
||||
|
||||
## 0.8.11
|
||||
|
||||
* Add: store and use cookies between requests; customizable cookie jars also possible. (stockholmux)
|
||||
* Fix: attributes named the same as prototype properties of `NamedNodeMap` no longer break jsdom. (papandreou)
|
||||
* Fix: `removeAttributeNS` should not throw on missing attributes. (lddubeau)
|
||||
* Change: remove `__proto__`, `__defineGetter__`, and `__defineSetter__` usage, as part of a project to make jsdom work better across multiple environments. (lawnsea)
|
||||
|
||||
## 0.8.10
|
||||
|
||||
* Add: `hash` property to `HTMLAnchorElement`. (fr0z3nk0)
|
||||
|
||||
## 0.8.9
|
||||
|
||||
* Upgrade: `cssom` to 0.3.0, adding support for `@-moz-document` and fixing a few other issues.
|
||||
* Upgrade: `cssstyle` to 0.2.6, adding support for many shorthand properties and better unit handling.
|
||||
|
||||
## 0.8.8
|
||||
|
||||
* Fix: avoid repeated `NodeList.prototype.length` calculation, for a speed improvement. (peller)
|
||||
|
||||
## 0.8.7
|
||||
|
||||
* Add: `host` property to `HTMLAnchorElement`. (sporchia)
|
||||
|
||||
## 0.8.6
|
||||
|
||||
* Fix: stop accidentally modifying `Error.prototype`. (mitar)
|
||||
* Add: a dummy `getBoundingClientRect` method, that returns `0` for all properties of the rectangle, is now implemented. (F1LT3R)
|
||||
|
||||
## 0.8.5
|
||||
|
||||
* Add: `href` property on `CSSStyleSheet` instances for external CSS files. (FrozenCow)
|
||||
|
||||
## 0.8.4
|
||||
|
||||
* Add: typed array constructors on the `window`. (nlacasse)
|
||||
* Fix: `querySelector` and `querySelectorAll` should be on the prototypes of `Element` and `Document`, not own-properties. (mbostock)
|
||||
|
||||
## 0.8.3
|
||||
|
||||
* Fix: when auto-detecting whether the first parameter to `jsdom.env` is a HTML string or a filename, deal with long strings correctly instead of erroring. (baryshev)
|
||||
|
||||
## 0.8.2
|
||||
|
||||
* Add: basic `window.history` support, including `back`, `forward`, `go`, `pushState`, and `replaceState`. (ralphholzmann)
|
||||
* Add: if an `<?xml?>` declaration starts the document, will try to parse as XML, e.g. not lowercasing the tags. (robdodson)
|
||||
* Fix: tag names passed to `createElement` are coerced to strings before evaluating.
|
||||
|
||||
## 0.8.1 (hotfix)
|
||||
|
||||
* Fix: a casing issue that prevented jsdom from loading on Unix and Solaris systems. (dai-shi)
|
||||
* Fix: `window.location.replace` was broken. (dai-shi)
|
||||
* Fix: update minimum htmlparser2 version, to ensure you get the latest parsing-related bugfixes.
|
||||
|
||||
## 0.8.0
|
||||
|
||||
* Add: working `XMLHttpRequest` support, including cookie passing! (dai-shi)
|
||||
* Add: there is now a `window.navigator.noUI` property that evaluates to true, if you want to specifically distinguish jsdom in your tests.
|
||||
|
||||
## 0.7.0
|
||||
|
||||
* Change: the logic when passing `jsdom.env` a string is more accurate, and you can be explicit by using the `html`, `url`, or `file` properties. This is a breaking change in the behavior of `html`, which used to do the same auto-detection logic as the string-only version.
|
||||
* Fix: errors raised in scripts are now passed to `jsdom.env`'s callback. (airportyh)
|
||||
* Fix: set `window.location.href` correctly when using `jsdom.env` to construct a window from a URL, when that URL causes a redirect. (fegs)
|
||||
* Add: a more complete and accurate `window.location` object, which includes firing `hashchange` events when the hash is changed. (dai-shi)
|
||||
* Add: when using a non-implemented feature, mention exactly what it was that is not implemented in the error message. (papandreou)
|
||||
|
||||
## 0.6.5
|
||||
|
||||
* Fix: custom attributes whose names were the same as properties of `Object.prototype`, e.g. `"constructor"`, would confuse jsdom massively.
|
||||
|
||||
## 0.6.4
|
||||
|
||||
* Fix: CSS selectors which contain commas inside quotes are no longer misinterpreted. (chad3814)
|
||||
* Add: `<img>` elements now fire `"load"` events when their `src` attributes are changed. (kapouer)
|
||||
|
||||
## 0.6.3
|
||||
|
||||
* Fix: better automatic detection of URLs vs. HTML fragments when using `jsdom.env`. (jden)
|
||||
|
||||
## 0.6.2
|
||||
|
||||
* Fix: URL resolution to be amazing and extremely browser-compatible, including the interplay between the document's original URL, any `<base>` tags that were set, and any relative `href`s. This impacts many parts of jsdom having to do with external resources or accurate `href` and `src` attributes. (deitch)
|
||||
* Add: access to frames and iframes via named properties. (adrianlang)
|
||||
* Fix: node-canvas integration, which had been broken since 0.5.7.
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Make the code parseable with Esprima. (squarooticus)
|
||||
* Use the correct `package.json` field `"repository"` instead of `"repositories"` to prevent npm warnings. (jonathanong)
|
||||
|
||||
## 0.6.0
|
||||
|
||||
Integrated a new HTML parser, [htmlparser2](https://npmjs.org/package/htmlparser2), from fb55. This is an actively maintained and much less buggy parser, fixing many of our parsing issues, including:
|
||||
|
||||
* Parsing elements with optional closing tags, like `<p>` or `<td>`.
|
||||
* The `innerHTML` of `<script>` tags no longer cuts off the first character.
|
||||
* Empty attributes now have `""` as their value instead of the attribute name.
|
||||
* Multiline attributes no longer get horribly mangled.
|
||||
* Attribute names can now be any value allowed by HTML5, including crazy things like `^`.
|
||||
* Attribute values can now contain any value allowed by HTML5, including e.g. `>` and `<`.
|
||||
|
||||
## 0.5.7
|
||||
|
||||
* Fix: make event handlers attached via `on<event>` more spec-compatible, supporting `return false` and passing the `event` argument. (adrianlang)
|
||||
* Fix: make the getter for `textContent` more accurate, e.g. in cases involving comment nodes or processing instruction nodes. (adrianlang)
|
||||
* Fix: make `<canvas>` behave like a `<div>` when the `node-canvas` package isn't available, instead of crashing. (stepheneb)
|
||||
|
||||
## 0.5.6
|
||||
|
||||
* Fix: `on<event>` properties are correctly updated when using `setAttributeNode`, `attributeNode.value =`, `removeAttribute`, and `removeAttributeNode`; before it only worked with `setAttribute`. (adrianlang)
|
||||
* Fix: `HTMLCollection`s now have named properties based on their members' `id` and `name` attributes, e.g. `form.elements.inputId` is now present. (adrianlang)
|
||||
|
||||
## 0.5.5
|
||||
|
||||
* Fix: `readOnly` and `selected` properties were not correct when their attribute values were falsy, e.g. `<option selected="">`. (adrianlang)
|
||||
|
||||
## 0.5.4
|
||||
|
||||
This release, and all future releases, require at least Node.js 0.8.
|
||||
|
||||
* Add: parser can now be set via `jsdom.env` configuration. (xavi-)
|
||||
* Fix: accessing `rowIndex` for table rows that are not part of a table would throw. (medikoo)
|
||||
* Fix: several places in the code accidentally created global variables, or referenced nonexistant values. (xavi-)
|
||||
* Fix: `<img>` elements' `src` properties now evaluate relative to `location.href`, just like `<a>` elements' `href` properties. (brianmaissy)
|
||||
|
||||
## 0.5.3
|
||||
|
||||
This release is compatible with Node.js 0.6, whereas all future releases will require at least Node.js 0.8.
|
||||
|
||||
* Fix: `getAttributeNS` now returns `null` for attributes that are not present, just like `getAttribute`. (mbostock)
|
||||
* Change: `"request"` dependency pinned to version 2.14 for Node.js 0.6 compatibility.
|
||||
|
||||
## 0.5.2
|
||||
|
||||
* Fix: stylesheets with `@-webkit-keyframes` rules were crashing calls to `getComputedStyle`.
|
||||
* Fix: handling of `features` option to `jsdom.env`.
|
||||
* Change: retain the value of the `style` attribute until the element's `style` property is touched. (papandreou)
|
||||
|
||||
## 0.5.1
|
||||
|
||||
* Fix: `selectedIndex` now changes correctly in response to `<option>` elements being selected. This makes `<select>` elements actually work like you would want, especially with jQuery. (xcoderzach)
|
||||
* Fix: `checked` works correctly on radio buttons, i.e. only one can be checked and clicking on one does not uncheck it. Previously they worked just like checkboxes. (xcoderzach)
|
||||
* Fix: `click()` on `<input>` elements now fires a click event. (xcoderzach)
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Fix: Make `contextify` a non-optional dependency. jsdom never worked without it, really, so this just caused confusion.
|
||||
|
||||
## 0.4.2
|
||||
|
||||
* Fix: `selected` now returns true for the first `<option>` in a `<select>` if nothing is explicitly set.
|
||||
* Fix: tweaks to accuracy and speed of the `querySelectorAll` implementation.
|
||||
|
||||
## 0.4.1 (hotfix)
|
||||
|
||||
* Fix: crashes when loading HTML files with `<a>` tags with no `href` attribute. (eleith)
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Fix: `getAttribute` now returns `null` for attributes that are not present, as per DOM4 (but in contradiction to DOM1 through DOM3).
|
||||
* Fix: static `NodeList`-returning methods (such as `querySelectorAll`) now return a real `NodeList` instance.
|
||||
* Change: `NodeList`s no longer expose nonstandard properties to the world, like `toArray`, without first prefixing them with an underscore.
|
||||
* Change: `NodeList`s no longer inconsistently have array methods. Previously, live node lists would have `indexOf`, while static node lists would have them all. Now, they have no array methods at all, as is correct per the specification.
|
||||
|
||||
## 0.3.4
|
||||
|
||||
* Fix: stylesheets with `@media` rules were crashing calls to `getComputedStyle`, e.g. those in jQuery's initialization.
|
||||
|
||||
## 0.3.3
|
||||
|
||||
* Fix: make `document.write` calls insert new elements correctly. (johanoverip, kblomquist).
|
||||
* Fix: `<input>` tags with no `type` attribute now return a default value of `"text"` when calling `inputEl.getAttribute("type")`.
|
||||
|
||||
## 0.3.2
|
||||
|
||||
* Fix: stylesheets with "joining" rules (i.e. those containing comma-separated selectors) now apply when using `getComputedStyle`. (chad3814, godmar)
|
||||
* Add: support for running the tests using @aredridel's [html5](https://npmjs.org/package/html5) parser, as a prelude toward maybe eventually making this the default and fixing various parsing bugs.
|
||||
|
||||
## 0.3.1 (hotfix)
|
||||
|
||||
* Fix: crashes when invalid selectors were present in stylesheets.
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Fix: a real `querySelector` implementation, courtesy of the nwmatcher project, solves many outstanding `querySelector` bugs.
|
||||
* Add: `matchesSelector`, again via nwmatcher.
|
||||
* Add: support for styles coming from `<style>` and `<link rel="stylesheet">` elements being applied to the results of `window.getComputedStyle`. (chad3814)
|
||||
* Add: basic implementation of `focus()` and `blur()` methods on appropriate elements. More work remains.
|
||||
* Fix: script filenames containing spaces will now work when passed to `jsdom.env`. (TomNomNom)
|
||||
* Fix: elements with IDs `toString`, `hasOwnProperty`, etc. could cause lots of problems.
|
||||
* Change: A window's `load` event always fires asynchronously now, even if no external resources are necessary.
|
||||
* Change: turning off mutation events is not supported, since doing so breaks external-resource fetching.
|
||||
|
||||
## 0.2.19
|
||||
|
||||
* Fix: URL resolution was broken on pages that included `href`-less `<base>` tags.
|
||||
* Fix: avoid putting `attr` in the global scope when using node-canvas. (starsquare)
|
||||
* Add: New `SkipExternalResources` feature accepts a regular expression. (fgalassi)
|
||||
|
||||
## 0.2.18
|
||||
|
||||
* Un-revert: cssstyle has fixed its memory problems, so we get back accurate `cssText` and `style` properties again.
|
||||
|
||||
## 0.2.17 (hotfix)
|
||||
|
||||
* Revert: had to revert the use of the cssstyle package. `cssText` and `style` properties are no longer as accurate.
|
||||
* Fix: cssstyle was causing out-of-memory errors on some larger real-world pages, e.g. reddit.com.
|
||||
|
||||
## 0.2.16
|
||||
* Update: Sizzle version updated to circa September 2012.
|
||||
* Fix: when setting a text node's value to a falsy value, convert it to a string instead of coercing it to `""`.
|
||||
* Fix: Use the cssstyle package for `CSSStyleDeclaration`, giving much more accurate `cssText` and `style` properties on all elements. (chad3814)
|
||||
* Fix: the `checked` property on checkboxes and radiobuttons now reflects the attribute correctly.
|
||||
* Fix: `HTMLOptionElement`'s `text` property should return the option's text, not its value.
|
||||
* Fix: make the `name` property only exist on certain specific tags, and accurately reflect the corresponding `name` attribute.
|
||||
* Fix: don't format `outerHTML` (especially important for `<pre>` elements).
|
||||
* Fix: remove the `value` property from `Text` instances (e.g. text nodes).
|
||||
* Fix: don't break in the presence of a `String.prototype.normalize` method, like that of sugar.js.
|
||||
* Fix: include level3/xpath correctly.
|
||||
* Fix: many more tests passing, especially related to file:/// URLs on Windows. Tests can now be run with `npm test`.
|
||||
|
||||
## 0.2.15
|
||||
* Fix: make sure that doctypes don't get set as the documentElement (Aria Stewart)
|
||||
* Add: HTTP proxy support for jsdom.env (Eugene Ware)
|
||||
* Add: .hostname and .pathname properties to Anchor elements to comply with WHATWG standard (Avi Deitcher)
|
||||
* Fix: Only decode HTML entities in text when not inside a `<script>` or `<style>` tag. (Andreas Lind Petersen)
|
||||
* Fix: HTMLSelectElement single selection implemented its type incorrectly as 'select' instead of 'select-one' (John Roberts)
|
||||
|
||||
## 0.2.14
|
||||
* Fix: when serializing single tags use ' />' instead of '/>' (kapouer)
|
||||
* Fix: support for contextify simulation using vm.runInContext (trodrigues)
|
||||
* Fix: allow jsdom.env's config.html to handle file paths which contain spaces (shinuza)
|
||||
* Fix: Isolate QuerySelector from prototype (Nao Iizuka)
|
||||
* Add: setting textContent to '' or clears children (Jason Davies)
|
||||
* Fix: jsdom.env swallows exceptions that occur in the callback (Xavi)
|
||||
|
||||
## 0.2.13
|
||||
* Fix: remove unused style property which was causing explosions in 0.2.12 and node 0.4.7
|
||||
|
||||
## 0.2.12
|
||||
* Fix: do not include gmon.out/v8.log/tests in npm distribution
|
||||
|
||||
## 0.2.11
|
||||
* Add: allow non-unique element ids (Avi Deitcher)
|
||||
* Fix: make contexify an optional dependency (Isaac Schlueter)
|
||||
* Add: scripts injected by jsdom are now marked with a 'jsdom' class for serialization's sake (Peter Lyons)
|
||||
* Fix: definition for ldquo entity (Andrew Morton)
|
||||
* Fix: access NamedNodeMap items via property (Brian McDaniel)
|
||||
* Add: upgrade sizzle from 1.0 to [fe2f6181](https://github.com/jquery/sizzle/commit/fe2f618106bb76857b229113d6d11653707d0b22) which is roughly 1.5.1
|
||||
* Add: documentation now includes `jsdom.level(x, 'feature')`
|
||||
* Fix: make `toArray` and `item` on `NodeList` objects non-enumerable properties
|
||||
* Add: a reference to `window.close` in the readme
|
||||
* Fix: Major performance boost (Felix Gnass)
|
||||
* Fix: Using querySelector `:not()` throws a `ReferenceError` (Felix Gnass)
|
||||
|
||||
## 0.2.10
|
||||
* Fix: problems with lax dependency versions
|
||||
* Fix: CSSOM constructors are hung off of the dom (Brian McDaniel)
|
||||
* Fix: move away from deprecated 'sys' module
|
||||
* Fix: attribute event handlers on bubbling path aren't called (Brian McDaniel)
|
||||
* Fix: setting textarea.value to markup should not be parsed (Andreas Lind Petersen)
|
||||
* Fix: content of script tags should not be escaped (Ken Sternberg)
|
||||
* Fix: DocumentFeatures for iframes with no src attribute. (Brian McDaniel) Closes #355
|
||||
* Fix: 'trigger' to 'raise' to be a bit more descriptive
|
||||
* Fix: When `ProcessExternalResources['script']` is disabled, do _not_ run inline event handlers. #355
|
||||
* Add: verbose flag to test runner (to show tests as they are running and finishing)
|
||||
|
||||
## 0.2.9
|
||||
* Fix: ensure features are properly reset after a jsdom.env invocation. Closes #239
|
||||
* Fix: ReferenceError in the scanForImportRules helper function
|
||||
* Fix: bug in appendHtmlToElement with HTML5 parser (Brian McDaniel)
|
||||
* Add: jsonp support (lheiskan)
|
||||
* Fix: for setting script element's text property (Brian McDaniel)
|
||||
* Fix: for jsdom.env src bug
|
||||
* Add: test for jsdom.env src bug (multiple done calls)
|
||||
* Fix: NodeList properties should enumerate like arrays (Felix Gnass)
|
||||
* Fix: when downloading a file, include the url.search in file path
|
||||
* Add: test for making a jsonp request with jquery from jsdom window
|
||||
* Add: test case for issue #338
|
||||
* Fix: double load behavior when mixing jsdom.env's `scripts` and `src` properties (cjroebuck)
|
||||
|
||||
## 0.2.8 (hotfix)
|
||||
* Fix: inline event handlers are ignored by everything except for the javascript context
|
||||
|
||||
## 0.2.7 (hotfix)
|
||||
* Fix stylesheet loading
|
||||
|
||||
## 0.2.6
|
||||
* Add: support for window.location.search and document.cookie (Derek Lindahl)
|
||||
* Add: jsdom.env now has a document configuation option which allows users to change the referer of the document (Derek Lindahl)
|
||||
* Fix: allow users to use different jsdom levels in the same process (sinegar)
|
||||
* Fix: removeAttributeNS no longer has a return value (Jason Davies)
|
||||
* Add: support for encoding/decoding all html entities from html4/5 (papandreou)
|
||||
* Add: jsdom.env() accepts the same features object seen in jsdom.jsdom and friends
|
||||
|
||||
## 0.2.5
|
||||
* Fix: serialize special characters in Element.innerHTML/Element.attributes like a grade A browser (Jason Priestley)
|
||||
* Fix: ensure Element.getElementById only returns elements that are attached to the document
|
||||
* Fix: ensure an Element's id is updated when changing the nodeValue of the 'id' attribute (Felix Gnass)
|
||||
* Add: stacktrace to error reporter (Josh Marshall)
|
||||
* Fix: events now bubble up to the window (Jason Davies)
|
||||
* Add: initial window.location.hash support (Josh Marshall)
|
||||
* Add: Node#insertBefore should do nothing when both params are the same node (Jason Davies)
|
||||
* Add: fixes for DOMAttrModified mutation events (Felix Gnass)
|
||||
|
||||
## 0.2.4
|
||||
* Fix: adding script to invalid/incomplete dom (document.documentElement) now catches the error and passes it in the `.env` callback (Gregory Tomlinson)
|
||||
* Cleanup: trigger and html tests
|
||||
* Add: support for inline event handlers (ie: `<div onclick='some.horrible.string()'>`) (Brian McDaniel)
|
||||
* Fix: script loading over https (Brian McDaniel) #280
|
||||
* Add: using style.setProperty updates the style attribute (Jimmy Mabey).
|
||||
* Add: invalid markup is reported as an error and attached to the associated element and document
|
||||
* Fix: crash when setChild() failes to create new DOM element (John Hurliman)
|
||||
* Added test for issue #287.
|
||||
* Added support for inline event handlers.
|
||||
* Moved frame tests to test/window/frame.js and cleaned up formatting.
|
||||
* Moved script execution tests to test/window/script.js.
|
||||
* Fix a crash when setChild() fails to create a new DOM element
|
||||
* Override CSSOM to update style attribute
|
||||
|
||||
## 0.2.3
|
||||
* Fix: segfault due to window being garbage collected prematurely
|
||||
NOTE: you must manually close the window to free memory (window.close())
|
||||
|
||||
## 0.2.2
|
||||
* Switch to Contextify to manage the window's script execution.
|
||||
* Fix: allow nodelists to have a length of 0 and toArray to return an empty array
|
||||
* Fix: style serialization; issues #230 and #259
|
||||
* Fix: Incomplete DOCTYPE causes JavaScript error
|
||||
* Fix: indentation, removed outdated debug code and trailing whitespace.
|
||||
* Prevent JavaScript error when parsing incomplete `<!DOCTYPE>`. Closes #259.
|
||||
* Adding a test from brianmcd that ensures that setTimeout callbacks execute in the context of the window
|
||||
* Fixes issue 250: make `document.parentWindow === window` work
|
||||
* Added test to ensure that timer callbacks execute in the window context.
|
||||
* Fixes 2 issues in ResourceQueue
|
||||
* Make frame/iframe load/process scripts if the parent has the features enabled
|
||||
|
||||
## 0.2.1
|
||||
* Javascript execution fixes [#248, #163, #179]
|
||||
* XPath (Yonathan and Daniel Cassidy)
|
||||
* Start of cssom integration (Yonathan)
|
||||
* Conversion of tests to nodeunit! (Martin Davis)
|
||||
* Added sizzle tests, only failing 3/15
|
||||
* Set the title node's textContent rather than its innerHTML #242. (Andreas Lind Petersen)
|
||||
* The textContent getter now walks the DOM and extract the text properly. (Andreas Lind Petersen)
|
||||
* Empty scripts won't cause jsdom.env to hang #172 (Karuna Sagar)
|
||||
* Every document has either a body or a frameset #82. (Karuna Sagar)
|
||||
* Added the ability to grab a level by string + feature. ie: jsdom.level(2, 'html') (Aria Stewart)
|
||||
* Cleaned up htmlencoding and fixed character (de)entification #147, #177 (Andreas Lind Petersen)
|
||||
* htmlencoding.HTMLDecode: Fixed decoding of `<`, `>`, `&`, and `'`. Closes #147 and #177.
|
||||
* Require dom level as a string or object. (Aria Stewart)
|
||||
* JS errors ar triggered on the script element, not document. (Yonathan)
|
||||
* Added configuration property 'headers' for HTTP request headers. (antonj)
|
||||
* Attr.specified is readonly - Karuna Sagar
|
||||
* Removed return value from setAttributeNS() #207 (Karuna Sagar)
|
||||
* Pass the correct script filename to runInContext. (robin)
|
||||
* Add http referrer support for the download() function. (Robin)
|
||||
* First attempt at fixing the horrible memory leak via window.stopTimers() (d-ash)
|
||||
* Use vm instead of evals binding (d-ash)
|
||||
* Add a way to set the encoding of the jsdom.env html request.
|
||||
* Fixed various typos/lint problems (d-ash)
|
||||
* The first parameter download is now the object returned by URL.parse(). (Robin)
|
||||
* Fixed serialization of elements with a style attribute.
|
||||
* Added src config option to jsdom.env() (Jerry Sievert)
|
||||
* Removed dead code from getNamedItemNS() (Karuna Sagar)
|
||||
* Changes to language/javascript so jsdom would work on v0.5.0-pre (Gord Tanner)
|
||||
* Correct spelling of "Hierarchy request error" (Daniel Cassidy)
|
||||
* Node and Exception type constants are available in all levels. (Daniel Cassidy)
|
||||
* Use \n instead of \r\n during serialization
|
||||
* Fixed auto-insertion of body/html tags (Adrian Makowski)
|
||||
* Adopt unowned nodes when added to the tree. (Aria Stewart)
|
||||
* Fix the selected and defaultSelected fields of `option` element. - Yonathan
|
||||
* Fix: EventTarget.getListeners() now returns a shallow copy so that listeners can be safely removed while an event is being dispatched. (Felix Gnass)
|
||||
* Added removeEventListener() to DOMWindow (Felix Gnass)
|
||||
* Added the ability to pre-load scripts for jsdom.env() (Jerry Sievert)
|
||||
* Mutation event tests/fixes (Felix Gnass)
|
||||
* Changed HTML serialization code to (optionally) pretty print while traversing the tree instead of doing a regexp-based postprocessing. (Andreas Lind Petersen)
|
||||
* Relative and absolute urls now work as expected
|
||||
* setNamedItem no longer sets Node.parentNode #153 (Karuna Sagar)
|
||||
* Added missing semicolon after entity name - Felix Gnass
|
||||
* Added NodeList#indexOf implementation/tests (Karuna Sagar)
|
||||
* resourceLoader.download now works correctly with https and redirects (waslogic)
|
||||
* Scheme-less URLs default to the current protocol #87 (Alexander Flatter)
|
||||
* Simplification the prevSibling(), appendChild(), insertBefore() and replaceChild() code (Karuna Sagar)
|
||||
* Javascript errors use core.Node.trigger (Alexander Flatter)
|
||||
* Add core.Document.trigger in level1/core and level2/events; Make DOMWindow.console use it (Alexander Flatter)
|
||||
* Resource resolver fixes (Alexander Flatter)
|
||||
* Fix serialization of doctypes with new lines #148 (Karuna Sagar)
|
||||
* Child nodes are calculated immediately instead of after .length is called #169, #171, #176 (Karuna Sagar)
|
44
bower_components/jsdom/Contributing.md
vendored
44
bower_components/jsdom/Contributing.md
vendored
@ -1,44 +0,0 @@
|
||||
## Mission
|
||||
|
||||
jsdom is, as said in our tagline, “A JavaScript implementation of the DOM and HTML standards.” Anything that helps us be better at that is welcome.
|
||||
|
||||
## Status
|
||||
|
||||
We're transitioning from an older model based on separate and obsolete "DOM1," "DOM2," and "DOM3" specs, into one based on the modern DOM and HTML living standards. Nobody has really set aside the time to do the proper sort of architectural overhaul this transition necessitates, so things might seem a bit strange, but in the meantime we're doing OK with the current structure.
|
||||
|
||||
## Existing Tests
|
||||
|
||||
The DOM, thankfully, has lots of tests already out there. Those already included in the repository are of two types:
|
||||
|
||||
* Auto-generated or adapted from older W3C tests.
|
||||
* Written by contributors to plug gaps in those tests.
|
||||
|
||||
Of these, of course, the first is preferable. When we find gaps, we usually add the tests at the bottom of the relevant auto-generated test suite, e.g. in `test/level2/html.js`.
|
||||
|
||||
The current test compliance is tracked [in the README](https://github.com/tmpvar/jsdom#test-compliance).
|
||||
|
||||
## Contributing
|
||||
|
||||
When contributing, the first question you should ask is:
|
||||
|
||||
**Can I exhibit how the browsers differ from what jsdom is doing?**
|
||||
|
||||
If you can, then you've almost certainly found a bug in or missing feature of jsdom, and we'd love to have your contribution. In that case, move on to:
|
||||
|
||||
**What WHATWG spec covers this potential contribution?**
|
||||
|
||||
Almost all of our relevant functionality is covered in either the [DOM Living Standard](http://dom.spec.whatwg.org/) or the [HTML Living Standard](http://www.whatwg.org/specs/web-apps/current-work/). There are various obsolete W3C specs ("DOM Level 2" etc.) that were never really implemented in browsers, and there is also the "DOM Level 4" W3C fork of the WHATWG DOM Living Standard. But we try to stick to the two main WHATWG specs for jsdom these days.
|
||||
|
||||
Once you have that nailed down, you'll want to ask:
|
||||
|
||||
**Where can I get an official test for this functionality?**
|
||||
|
||||
We ported in some of the tests for the old DOM1 and DOM2 specs, as well as some DOM3 ones that are currently disabled. These are sometimes wrong however (given that browsers never really implemented those specs), and we have had to change, add to, or remove them in the past.
|
||||
|
||||
These days the [w3c/web-platform-tests](https://github.com/w3c/web-platform-tests) project has an ever-growing set of tests for the DOM and HTML standards, and is the best place to try to find good tests to adapt. jsdom doesn't yet have the ability to run those tests directly (that's [#666](https://github.com/tmpvar/jsdom/issues/666)), but you can copy and adapt them as you see fit. If you can't find anything, you can always ask [public-webapps-testsuite@w3.org](mailto:public-webapps-testsuite@w3.org), [like I did](http://lists.w3.org/Archives/Public/public-webapps-testsuite/2012Aug/0001.html), or stop into the #whatwg IRC channel.
|
||||
|
||||
If there is no official test covering the functionality you're after, then you can write your own. You might want to submit a pull request to the web-platform-tests repo too!
|
||||
|
||||
## Issues
|
||||
|
||||
Finally, we have [an active and full issue tracker](https://github.com/tmpvar/jsdom/issues) that we'd love you to help with. Go find something broken, and fix it!
|
22
bower_components/jsdom/LICENSE.txt
vendored
22
bower_components/jsdom/LICENSE.txt
vendored
@ -1,22 +0,0 @@
|
||||
Copyright (c) 2010 Elijah Insua
|
||||
|
||||
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:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
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.
|
352
bower_components/jsdom/README.md
vendored
352
bower_components/jsdom/README.md
vendored
@ -1,352 +0,0 @@
|
||||
# jsdom
|
||||
|
||||
A JavaScript implementation of the W3C DOM.
|
||||
|
||||
## Install
|
||||
|
||||
```bash
|
||||
$ npm install jsdom
|
||||
```
|
||||
|
||||
If this gives you trouble with errors about installing Contextify, especially on Windows, see [below](#contextify).
|
||||
|
||||
## Human contact
|
||||
|
||||
see: [mailing list](http://groups.google.com/group/jsdom)
|
||||
|
||||
## Easymode
|
||||
|
||||
Bootstrapping a DOM is generally a difficult process involving many error prone steps. We didn't want jsdom to fall into the same trap and that is why a new method, `jsdom.env()`, has been added in jsdom 0.2.0 which should make everyone's lives easier.
|
||||
|
||||
You can use it with a URL
|
||||
|
||||
```js
|
||||
// Count all of the links from the Node.js build page
|
||||
var jsdom = require("jsdom");
|
||||
|
||||
jsdom.env(
|
||||
"http://nodejs.org/dist/",
|
||||
["http://code.jquery.com/jquery.js"],
|
||||
function (errors, window) {
|
||||
console.log("there have been", window.$("a").length, "nodejs releases!");
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
or with raw HTML
|
||||
|
||||
```js
|
||||
// Run some jQuery on a html fragment
|
||||
var jsdom = require("jsdom");
|
||||
|
||||
jsdom.env(
|
||||
'<p><a class="the-link" href="https://github.com/tmpvar/jsdom">jsdom\'s Homepage</a></p>',
|
||||
["http://code.jquery.com/jquery.js"],
|
||||
function (errors, window) {
|
||||
console.log("contents of a.the-link:", window.$("a.the-link").text());
|
||||
}
|
||||
);
|
||||
```
|
||||
|
||||
or with a configuration object
|
||||
|
||||
```js
|
||||
// Print all of the news items on hackernews
|
||||
var jsdom = require("jsdom");
|
||||
|
||||
jsdom.env({
|
||||
url: "http://news.ycombinator.com/",
|
||||
scripts: ["http://code.jquery.com/jquery.js"],
|
||||
done: function (errors, window) {
|
||||
var $ = window.$;
|
||||
console.log("HN Links");
|
||||
$("td.title:not(:last) a").each(function() {
|
||||
console.log(" -", $(this).text());
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
or with raw JavaScript source
|
||||
|
||||
```js
|
||||
// Print all of the news items on hackernews
|
||||
var jsdom = require("jsdom");
|
||||
var fs = require("fs");
|
||||
var jquery = fs.readFileSync("./jquery.js", "utf-8");
|
||||
|
||||
jsdom.env({
|
||||
url: "http://news.ycombinator.com/",
|
||||
src: [jquery],
|
||||
done: function (errors, window) {
|
||||
var $ = window.$;
|
||||
console.log("HN Links");
|
||||
$("td.title:not(:last) a").each(function () {
|
||||
console.log(" -", $(this).text());
|
||||
});
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
### How it works
|
||||
`jsdom.env` is built for ease of use, which is rare in the world of the DOM! Since the web has some absolutely horrible JavaScript on it, as of jsdom 0.2.0 `jsdom.env` will not process external resources (scripts, images, etc). If you want to process the JavaScript use one of the methods below (`jsdom.jsdom` or `jsdom.jQueryify`)
|
||||
|
||||
```js
|
||||
jsdom.env(string, [scripts], [config], callback);
|
||||
```
|
||||
|
||||
The arguments are:
|
||||
|
||||
- `string`: may be a URL, file name, or HTML fragment
|
||||
- `scripts`: a string or array of strings, containing file names or URLs that will be inserted as `<script>` tags
|
||||
- `config`: see below
|
||||
- `callback`: takes two arguments
|
||||
- `error`: either an `Error` object if something failed initializing the window, or an array of error messages from the DOM if there were script errors
|
||||
- `window`: a brand new `window`
|
||||
|
||||
_Example:_
|
||||
|
||||
```js
|
||||
jsdom.env(html, function (errors, window) {
|
||||
// free memory associated with the window
|
||||
window.close();
|
||||
});
|
||||
```
|
||||
|
||||
If you would like to specify a configuration object only:
|
||||
|
||||
```js
|
||||
jsdom.env(config);
|
||||
```
|
||||
|
||||
- `config.html`: a HTML fragment
|
||||
- `config.file`: a file which jsdom will load HTML from; the resulting window's `location.href` will be a `file://` URL.
|
||||
- `config.url`: sets the resulting window's `location.href`; if `config.html` and `config.file` are not provided, jsdom will load HTML from this URL.
|
||||
- `config.scripts`: see `scripts` above.
|
||||
- `config.src`: an array of JavaScript strings that will be evaluated against the resulting document. Similar to `scripts`, but it accepts JavaScript instead of paths/URLs.
|
||||
- `config.jar`: a custom cookie jar, if desired; see [mikeal/request](https://github.com/mikeal/request) documentation.
|
||||
- `config.done`: see `callback` above.
|
||||
- `config.document`:
|
||||
- `referrer`: the new document will have this referrer.
|
||||
- `cookie`: manually set a cookie value, e.g. `'key=value; expires=Wed, Sep 21 2011 12:00:00 GMT; path=/'`.
|
||||
- `cookieDomain`: a cookie domain for the manually set cookie; defaults to `127.0.0.1`.
|
||||
- `config.features` : see `Flexibility` section below. **Note**: the default feature set for jsdom.env does _not_ include fetching remote JavaScript and executing it. This is something that you will need to **carefully** enable yourself.
|
||||
|
||||
Note that `config.done` is required, as is one of `config.html`, `config.file`, or `config.url`.
|
||||
|
||||
## For the hardcore
|
||||
|
||||
If you want to spawn a document/window and specify all sorts of options this is the section for you. This section covers the `jsdom.jsdom` method:
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom").jsdom;
|
||||
var doc = jsdom(markup, level, options);
|
||||
var window = doc.parentWindow;
|
||||
```
|
||||
|
||||
- `markup` is an HTML/XML document to be parsed. You can also pass `null` or an undefined value to get a basic document with empty `<head>` and `<body>` tags. Document fragments are also supported (including `""`), and will behave as sanely as possible (e.g. the resulting document will lack the `head`, `body` and `documentElement` properties if the corresponding elements aren't included).
|
||||
|
||||
- `level` is `null` (which means level3) by default, but you can pass another level if you'd like.
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom");
|
||||
var doc = jsdom.jsdom("<html><body></body></html>", jsdom.level(1, "core"));
|
||||
```
|
||||
|
||||
- `options` See the explanation of the `config` object above.
|
||||
|
||||
### Flexibility
|
||||
|
||||
One of the goals of jsdom is to be as minimal and light as possible. This section details how someone can change the behavior of `Document`s on the fly. These features are baked into the `DOMImplementation` that every `Document` has, and may be tweaked in two ways:
|
||||
|
||||
1. When you create a new `Document` using the jsdom builder (`require("jsdom").jsdom()`)
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom").jsdom;
|
||||
var doc = jsdom("<html><body></body></html>", null, {
|
||||
features: {
|
||||
FetchExternalResources : ["img"]
|
||||
}
|
||||
});
|
||||
```
|
||||
|
||||
Do note, that this will only affect the document that is currently being created. All other documents will use the defaults specified below (see: Default Features).
|
||||
|
||||
2. Before creating any documents, you can modify the defaults for all future documents:
|
||||
|
||||
```js
|
||||
require("jsdom").defaultDocumentFeatures = {
|
||||
FetchExternalResources: ["script"],
|
||||
ProcessExternalResources: false
|
||||
};
|
||||
```
|
||||
|
||||
#### Default Features
|
||||
|
||||
Default features are extremely important for jsdom as they lower the configuration requirement and present developers a set of consistent default behaviors. The following sections detail the available features, their defaults, and the values that jsdom uses.
|
||||
|
||||
|
||||
`FetchExternalResources`
|
||||
|
||||
- _Default_: `["script"]`
|
||||
- _Allowed_: `["script", "img", "css", "frame", "iframe", "link"]` or `false`
|
||||
|
||||
Enables/disables fetching files over the file system/HTTP.
|
||||
|
||||
`ProcessExternalResources`
|
||||
|
||||
- _Default_: `["script"]`
|
||||
- _Allowed_: `["script"]` or `false`
|
||||
|
||||
Disabling this will disable script execution (currently only JavaScript).
|
||||
|
||||
`SkipExternalResources`
|
||||
|
||||
- _Default_: `false`
|
||||
- _Allowed_: `/url to be skipped/` or `false`
|
||||
- _Example_: `/http:\/\/example.org/js/bad\.js/`
|
||||
|
||||
Do not download and process resources with url matching a regular expression.
|
||||
|
||||
### Canvas
|
||||
|
||||
jsdom includes support for using the [canvas](https://npmjs.org/package/canvas) package to extend any `<canvas>` elements with the canvas API. To make this work, you need to include canvas as a dependency in your project, as a peer of jsdom. If jsdom can find the canvas package, it will use it, but if it's not present, then `<canvas>` elements will behave like `<div>`s.
|
||||
|
||||
## More Examples
|
||||
|
||||
### Creating a document
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom");
|
||||
var doc = new (jsdom.level(1, "core").Document)();
|
||||
|
||||
console.log(doc.nodeName); // outputs: #document
|
||||
```
|
||||
|
||||
### Creating a browser-like BOM/DOM/Window
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom").jsdom;
|
||||
var document = jsdom("<html><head></head><body>hello world</body></html>");
|
||||
var window = document.parentWindow;
|
||||
|
||||
console.log(window.document.innerHTML);
|
||||
// output: "<html><head></head><body>hello world</body></html>"
|
||||
|
||||
console.log(window.innerWidth);
|
||||
// output: 1024
|
||||
|
||||
console.log(typeof window.document.getElementsByClassName);
|
||||
// outputs: function
|
||||
```
|
||||
|
||||
### jQueryify
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom");
|
||||
var window = jsdom.jsdom().parentWindow;
|
||||
|
||||
jsdom.jQueryify(window, "http://code.jquery.com/jquery.js", function () {
|
||||
window.$("body").append('<div class="testing">Hello World, It works</div>');
|
||||
|
||||
console.log(window.$(".testing").text());
|
||||
});
|
||||
```
|
||||
|
||||
### Passing objects to scripts inside the page
|
||||
|
||||
```js
|
||||
var jsdom = require("jsdom").jsdom;
|
||||
var window = jsdom().parentWindow;
|
||||
|
||||
window.__myObject = { foo: "bar" };
|
||||
|
||||
var scriptEl = window.document.createElement("script");
|
||||
scriptEl.src = "anotherScript.js";
|
||||
window.document.body.appendChild(scriptEl);
|
||||
|
||||
// anotherScript.js will have the ability to read `window.__myObject`, even
|
||||
// though it originated in Node!
|
||||
```
|
||||
|
||||
## Test Compliance:
|
||||
|
||||
```
|
||||
level1/core 535/535 100%
|
||||
level1/html 238/238 100%
|
||||
level1/svg 527/527 100%
|
||||
level2/core 287/287 100%
|
||||
level2/html 717/717 100%
|
||||
level2/style 15/15 100%
|
||||
level2/extra 4/4 100%
|
||||
level2/events 24/24 100%
|
||||
level3/xpath 93/93 100%
|
||||
whatwg/attributes 10/10 100%
|
||||
window/index 8/8 100%
|
||||
window/history 5/5 100%
|
||||
window/script 10/10 100%
|
||||
window/console 2/2 100%
|
||||
window/frame 17/17 100%
|
||||
sizzle/index 14/14 100%
|
||||
jsdom/index 84/84 100%
|
||||
jsdom/parsing 11/11 100%
|
||||
jsdom/env 25/25 100%
|
||||
jsdom/utils 11/11 100%
|
||||
jsonp/jsonp 1/1 100%
|
||||
browser/css 1/1 100%
|
||||
browser/index 34/34 100%
|
||||
------------------------------------------
|
||||
TOTALS: 0/2673 failed; 100% success
|
||||
```
|
||||
|
||||
### Running the tests
|
||||
|
||||
First you'll want to `npm install`. To run all the tests, use `npm test`, which just calls `node test/runner`.
|
||||
|
||||
Using `test/runner` directly, you can slice and dice which tests your want to run from different levels. Usage is as follows:
|
||||
|
||||
```
|
||||
test/runner --help
|
||||
Run the jsdom test suite
|
||||
|
||||
Options:
|
||||
-s, --suites suites that you want to run. ie: -s level1/core,1/html,html [string]
|
||||
-f, --fail-fast stop on the first failed test
|
||||
-h, --help show the help
|
||||
-t, --tests choose the test cases to run. ie: -t jquery
|
||||
```
|
||||
|
||||
## Contextify
|
||||
|
||||
[Contextify](https://npmjs.org/package/contextify) is a dependency of jsdom, used for running `<script>` tags within the
|
||||
page. In other words, it allows jsdom, which is run in Node.js, to run strings of JavaScript in an isolated environment
|
||||
that pretends to be a browser environment instead of a server. You can see how this is an important feature.
|
||||
|
||||
Unfortunately, doing this kind of magic requires C++. And in Node.js, using C++ from JavaScript means using "native
|
||||
modules." Native modules are compiled at installation time so that they work precisely for your machine; that is, you
|
||||
don't download a contextify binary from npm, but instead build one locally after downloading the source from npm.
|
||||
|
||||
|
||||
Unfortunately, getting C++ compiled within npm's installation system can be tricky, especially for Windows users. Thus,
|
||||
one of the most common problems with jsdom is trying to use it without the proper compilation tools installed.
|
||||
Here's what you need to compile Contextify, and thus to install jsdom:
|
||||
|
||||
### Windows
|
||||
|
||||
* A recent copy of the *x86* version of [Node.js for Windows](http://nodejs.org/download/), *not* the x64 version.
|
||||
* A copy of [Visual C++ 2010 Express](http://www.microsoft.com/visualstudio/eng/downloads#d-2010-express).
|
||||
* A copy of [Python 2.7](http://www.python.org/download/), installed in the default location of `C:\Python27`.
|
||||
|
||||
There are some slight modifications to this that can work; for example full versions of Visual Studio usually work, and
|
||||
sometimes you can even get an x64 version of Node.js working too. But it's tricky, so start with the basics!
|
||||
|
||||
### Mac
|
||||
|
||||
* XCode needs to be installed
|
||||
* "Command line tools for XCode" need to be installed
|
||||
* Launch XCode once to accept the license, etc. and ensure it's properly installed
|
||||
|
||||
### Linux
|
||||
|
||||
You'll need various build tools installed, like `make`, Python 2.7, and a compiler toolchain. How to install these will
|
||||
be specific to your distro, if you don't already have them.
|
23
bower_components/jsdom/benchmark/mark.js
vendored
23
bower_components/jsdom/benchmark/mark.js
vendored
@ -1,23 +0,0 @@
|
||||
// Taken from: http://ejohn.org/blog/javascript-benchmark-quality/
|
||||
module.exports = runTest(name, test, next, callback){
|
||||
var runs = [], r = 0;
|
||||
setTimeout(function(){
|
||||
var start = Date.now(), diff = 0;
|
||||
|
||||
for ( var n = 0; diff < 1000; n++ ) {
|
||||
test();
|
||||
diff = Date.now() - start;
|
||||
}
|
||||
|
||||
runs.push( n );
|
||||
|
||||
if ( r++ < 4 )
|
||||
setTimeout( arguments.callee, 0 );
|
||||
else {
|
||||
done(name, runs);
|
||||
if ( next )
|
||||
setTimeout( next, 0 );
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
|
@ -1,34 +0,0 @@
|
||||
var dom = require('../../lib/jsdom/level2/html').dom.level2.html;
|
||||
var browser = require('../../lib/jsdom/browser/index').windowAugmentation(dom);
|
||||
|
||||
var document = browser.document;
|
||||
var window = browser.window;
|
||||
var self = browser.self;
|
||||
var navigator = browser.navigator;
|
||||
var location = browser.location;
|
||||
|
||||
document.title = 'Test Title';
|
||||
|
||||
//GLOBAL
|
||||
var el = document.createElement('div');
|
||||
el.id = 'foo';
|
||||
el.innerHTML = '<em>This is a test</em> This <strong class="odd">is another</strong> test ';
|
||||
document.body.appendChild(el);
|
||||
|
||||
//SCOPED
|
||||
var el2 = browser.document.createElement('div');
|
||||
el2.id = 'foo2bar';
|
||||
el2.innerHTML = '<em class="odd">This is a test</em> This <strong>is another</strong> test ';
|
||||
browser.document.body.appendChild(el2);
|
||||
|
||||
console.log('getElementByid(foo2bar): ' + browser.document.getElementById('foo2bar'));
|
||||
console.log('getElementByid(foo): ' + browser.document.getElementById('foo'));
|
||||
console.log('getElementByTagName(em): ' + browser.document.getElementsByTagName('em'));
|
||||
console.log('getElementByClassName(odd): ' + browser.document.getElementsByClassName('odd'));
|
||||
|
||||
console.log('');
|
||||
console.log('document.body.outerHTML: ');
|
||||
console.log(document.body.outerHTML);
|
||||
|
||||
console.log('document.outerHTML: ');
|
||||
console.log(document.outerHTML);
|
1170
bower_components/jsdom/example/ender/ender.js
vendored
1170
bower_components/jsdom/example/ender/ender.js
vendored
File diff suppressed because it is too large
Load Diff
10
bower_components/jsdom/example/ender/run.js
vendored
10
bower_components/jsdom/example/ender/run.js
vendored
@ -1,10 +0,0 @@
|
||||
var jsdom = require("../../lib/jsdom");
|
||||
|
||||
jsdom.env("<html><body></body></html>", ["ender.js"], function(errors, window) {
|
||||
if (errors) {
|
||||
console.error(errors);
|
||||
return;
|
||||
}
|
||||
window.$('body').append("<div class='testing'>Hello World, It works!</div>");
|
||||
console.log(window.$(".testing").text());
|
||||
});
|
9
bower_components/jsdom/example/jquery/run.js
vendored
9
bower_components/jsdom/example/jquery/run.js
vendored
@ -1,9 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var jsdom = require("../../lib/jsdom");
|
||||
var window = jsdom.jsdom().parentWindow;
|
||||
|
||||
jsdom.jQueryify(window, "http://code.jquery.com/jquery.js", function() {
|
||||
window.jQuery("body").append("<div class='testing'>Hello World, It works!</div>");
|
||||
console.log(window.jQuery(".testing").text());
|
||||
});
|
243
bower_components/jsdom/example/node-xml/example.xml
vendored
243
bower_components/jsdom/example/node-xml/example.xml
vendored
@ -1,243 +0,0 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!-- Edited by XMLSpy® -->
|
||||
<CATALOG>
|
||||
<CD>
|
||||
<TITLE>Empire Burlesque</TITLE>
|
||||
<ARTIST>Bob Dylan</ARTIST>
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>Columbia</COMPANY>
|
||||
|
||||
<PRICE>10.90</PRICE>
|
||||
<YEAR>1985</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Hide your heart</TITLE>
|
||||
<ARTIST>Bonnie Tyler</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
|
||||
<COMPANY>CBS Records</COMPANY>
|
||||
<PRICE>9.90</PRICE>
|
||||
<YEAR>1988</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Greatest Hits</TITLE>
|
||||
<ARTIST>Dolly Parton</ARTIST>
|
||||
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>RCA</COMPANY>
|
||||
<PRICE>9.90</PRICE>
|
||||
<YEAR>1982</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Still got the blues</TITLE>
|
||||
|
||||
<ARTIST>Gary Moore</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Virgin records</COMPANY>
|
||||
<PRICE>10.20</PRICE>
|
||||
<YEAR>1990</YEAR>
|
||||
</CD>
|
||||
|
||||
<CD>
|
||||
<TITLE>Eros</TITLE>
|
||||
<ARTIST>Eros Ramazzotti</ARTIST>
|
||||
<COUNTRY>EU</COUNTRY>
|
||||
<COMPANY>BMG</COMPANY>
|
||||
<PRICE>9.90</PRICE>
|
||||
|
||||
<YEAR>1997</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>One night only</TITLE>
|
||||
<ARTIST>Bee Gees</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Polydor</COMPANY>
|
||||
|
||||
<PRICE>10.90</PRICE>
|
||||
<YEAR>1998</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Sylvias Mother</TITLE>
|
||||
<ARTIST>Dr.Hook</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
|
||||
<COMPANY>CBS</COMPANY>
|
||||
<PRICE>8.10</PRICE>
|
||||
<YEAR>1973</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Maggie May</TITLE>
|
||||
<ARTIST>Rod Stewart</ARTIST>
|
||||
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Pickwick</COMPANY>
|
||||
<PRICE>8.50</PRICE>
|
||||
<YEAR>1990</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Romanza</TITLE>
|
||||
|
||||
<ARTIST>Andrea Bocelli</ARTIST>
|
||||
<COUNTRY>EU</COUNTRY>
|
||||
<COMPANY>Polydor</COMPANY>
|
||||
<PRICE>10.80</PRICE>
|
||||
<YEAR>1996</YEAR>
|
||||
</CD>
|
||||
|
||||
<CD>
|
||||
<TITLE>When a man loves a woman</TITLE>
|
||||
<ARTIST>Percy Sledge</ARTIST>
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>Atlantic</COMPANY>
|
||||
<PRICE>8.70</PRICE>
|
||||
|
||||
<YEAR>1987</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Black angel</TITLE>
|
||||
<ARTIST>Savage Rose</ARTIST>
|
||||
<COUNTRY>EU</COUNTRY>
|
||||
<COMPANY>Mega</COMPANY>
|
||||
|
||||
<PRICE>10.90</PRICE>
|
||||
<YEAR>1995</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>1999 Grammy Nominees</TITLE>
|
||||
<ARTIST>Many</ARTIST>
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
|
||||
<COMPANY>Grammy</COMPANY>
|
||||
<PRICE>10.20</PRICE>
|
||||
<YEAR>1999</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>For the good times</TITLE>
|
||||
<ARTIST>Kenny Rogers</ARTIST>
|
||||
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Mucik Master</COMPANY>
|
||||
<PRICE>8.70</PRICE>
|
||||
<YEAR>1995</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Big Willie style</TITLE>
|
||||
|
||||
<ARTIST>Will Smith</ARTIST>
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>Columbia</COMPANY>
|
||||
<PRICE>9.90</PRICE>
|
||||
<YEAR>1997</YEAR>
|
||||
</CD>
|
||||
|
||||
<CD>
|
||||
<TITLE>Tupelo Honey</TITLE>
|
||||
<ARTIST>Van Morrison</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Polydor</COMPANY>
|
||||
<PRICE>8.20</PRICE>
|
||||
|
||||
<YEAR>1971</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Soulsville</TITLE>
|
||||
<ARTIST>Jorn Hoel</ARTIST>
|
||||
<COUNTRY>Norway</COUNTRY>
|
||||
<COMPANY>WEA</COMPANY>
|
||||
|
||||
<PRICE>7.90</PRICE>
|
||||
<YEAR>1996</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>The very best of</TITLE>
|
||||
<ARTIST>Cat Stevens</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
|
||||
<COMPANY>Island</COMPANY>
|
||||
<PRICE>8.90</PRICE>
|
||||
<YEAR>1990</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Stop</TITLE>
|
||||
<ARTIST>Sam Brown</ARTIST>
|
||||
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>A and M</COMPANY>
|
||||
<PRICE>8.90</PRICE>
|
||||
<YEAR>1988</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Bridge of Spies</TITLE>
|
||||
|
||||
<ARTIST>T'Pau</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Siren</COMPANY>
|
||||
<PRICE>7.90</PRICE>
|
||||
<YEAR>1987</YEAR>
|
||||
</CD>
|
||||
|
||||
<CD>
|
||||
<TITLE>Private Dancer</TITLE>
|
||||
<ARTIST>Tina Turner</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>Capitol</COMPANY>
|
||||
<PRICE>8.90</PRICE>
|
||||
|
||||
<YEAR>1983</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Midt om natten</TITLE>
|
||||
<ARTIST>Kim Larsen</ARTIST>
|
||||
<COUNTRY>EU</COUNTRY>
|
||||
<COMPANY>Medley</COMPANY>
|
||||
|
||||
<PRICE>7.80</PRICE>
|
||||
<YEAR>1983</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Pavarotti Gala Concert</TITLE>
|
||||
<ARTIST>Luciano Pavarotti</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
|
||||
<COMPANY>DECCA</COMPANY>
|
||||
<PRICE>9.90</PRICE>
|
||||
<YEAR>1991</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>The dock of the bay</TITLE>
|
||||
<ARTIST>Otis Redding</ARTIST>
|
||||
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>Atlantic</COMPANY>
|
||||
<PRICE>7.90</PRICE>
|
||||
<YEAR>1987</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Picture book</TITLE>
|
||||
|
||||
<ARTIST>Simply Red</ARTIST>
|
||||
<COUNTRY>EU</COUNTRY>
|
||||
<COMPANY>Elektra</COMPANY>
|
||||
<PRICE>7.20</PRICE>
|
||||
<YEAR>1985</YEAR>
|
||||
</CD>
|
||||
|
||||
<CD>
|
||||
<TITLE>Red</TITLE>
|
||||
<ARTIST>The Communards</ARTIST>
|
||||
<COUNTRY>UK</COUNTRY>
|
||||
<COMPANY>London</COMPANY>
|
||||
<PRICE>7.80</PRICE>
|
||||
|
||||
<YEAR>1987</YEAR>
|
||||
</CD>
|
||||
<CD>
|
||||
<TITLE>Unchain my heart</TITLE>
|
||||
<ARTIST>Joe Cocker</ARTIST>
|
||||
<COUNTRY>USA</COUNTRY>
|
||||
<COMPANY>EMI</COMPANY>
|
||||
|
||||
<PRICE>8.20</PRICE>
|
||||
<YEAR>1987</YEAR>
|
||||
</CD>
|
||||
</CATALOG>
|
45
bower_components/jsdom/example/node-xml/run.js
vendored
45
bower_components/jsdom/example/node-xml/run.js
vendored
@ -1,45 +0,0 @@
|
||||
var dom = require("../../lib/jsdom/level1/core").dom.level1.core;
|
||||
|
||||
// git clone git://github.com/robrighter/node-xml.git into ~/.node_libraries
|
||||
var xml = require("node-xml/lib/node-xml");
|
||||
|
||||
var doc = new dom.Document();
|
||||
var currentElement = doc;
|
||||
var totalElements = 0;
|
||||
var parser = new xml.SaxParser(function(cb) {
|
||||
cb.onStartDocument(function() {
|
||||
|
||||
});
|
||||
cb.onEndDocument(function() {
|
||||
console.log((doc.getElementsByTagName("*").length === totalElements) ? "success" : "fail");
|
||||
});
|
||||
cb.onStartElementNS(function(elem, attrs, prefix, uri, namespaces) {
|
||||
totalElements++;
|
||||
var element = doc.createElement(elem);
|
||||
currentElement.appendChild(element);
|
||||
currentElement = element;
|
||||
console.log("=> Started: " + elem + " uri="+uri +" (Attributes: " + JSON.stringify(attrs) + " )");
|
||||
});
|
||||
cb.onEndElementNS(function(elem, prefix, uri) {
|
||||
currentElement = currentElement.parentNode;
|
||||
console.log("<= End: " + elem + " uri="+uri + "\n");
|
||||
});
|
||||
cb.onCharacters(function(chars) {
|
||||
|
||||
});
|
||||
cb.onCdata(function(cdata) {
|
||||
console.log('<CDATA>'+cdata+"</CDATA>");
|
||||
});
|
||||
cb.onComment(function(msg) {
|
||||
console.log('<COMMENT>'+msg+"</COMMENT>");
|
||||
});
|
||||
cb.onWarning(function(msg) {
|
||||
console.log('<WARNING>'+msg+"</WARNING>");
|
||||
});
|
||||
cb.onError(function(msg) {
|
||||
console.log('<ERROR>'+JSON.stringify(msg)+"</ERROR>");
|
||||
});
|
||||
});
|
||||
|
||||
//example read from file
|
||||
parser.parseFile("example.xml");
|
742
bower_components/jsdom/example/pure/pure.js
vendored
742
bower_components/jsdom/example/pure/pure.js
vendored
@ -1,742 +0,0 @@
|
||||
/*!
|
||||
PURE Unobtrusive Rendering Engine for HTML
|
||||
|
||||
Licensed under the MIT licenses.
|
||||
More information at: http://www.opensource.org
|
||||
|
||||
Copyright (c) 2010 Michael Cvilic - BeeBole.com
|
||||
|
||||
Thanks to Rog Peppe for the functional JS jump
|
||||
revision: 2.33
|
||||
*/
|
||||
exports.pureInit = function(window, document) {
|
||||
var $p, pure = $p = function(){
|
||||
var sel = arguments[0],
|
||||
ctxt = false;
|
||||
|
||||
if(typeof sel === 'string'){
|
||||
ctxt = arguments[1] || false;
|
||||
}
|
||||
return $p.core(sel, ctxt);
|
||||
};
|
||||
|
||||
$p.core = function(sel, ctxt, plugins){
|
||||
//get an instance of the plugins
|
||||
var plugins = getPlugins(),
|
||||
templates = [];
|
||||
|
||||
//search for the template node(s)
|
||||
switch(typeof sel){
|
||||
case 'string':
|
||||
templates = plugins.find(ctxt || document, sel);
|
||||
if(templates.length === 0) {
|
||||
error('The template "' + sel + '" was not found');
|
||||
}
|
||||
break;
|
||||
case 'undefined':
|
||||
error('The template root is undefined, check your selector');
|
||||
break;
|
||||
default:
|
||||
templates = [sel];
|
||||
}
|
||||
|
||||
for(var i = 0, ii = templates.length; i < ii; i++){
|
||||
plugins[i] = templates[i];
|
||||
}
|
||||
plugins.length = ii;
|
||||
|
||||
// set the signature string that will be replaced at render time
|
||||
var Sig = '_s' + Math.floor( Math.random() * 1000000 ) + '_',
|
||||
// another signature to prepend to attributes and avoid checks: style, height, on[events]...
|
||||
attPfx = '_a' + Math.floor( Math.random() * 1000000 ) + '_',
|
||||
// rx to parse selectors, e.g. "+tr.foo[class]"
|
||||
selRx = /^(\+)?([^\@\+]+)?\@?([^\+]+)?(\+)?$/,
|
||||
// set automatically attributes for some tags
|
||||
autoAttr = {
|
||||
IMG:'src',
|
||||
INPUT:'value'
|
||||
};
|
||||
|
||||
return plugins;
|
||||
|
||||
|
||||
/* * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||
core functions
|
||||
* * * * * * * * * * * * * * * * * * * * * * * * * */
|
||||
|
||||
|
||||
// error utility
|
||||
function error(e){
|
||||
window.alert(e);
|
||||
if(typeof console !== 'undefined'){
|
||||
console.log(e);
|
||||
debugger;
|
||||
}
|
||||
throw('pure error: ' + e);
|
||||
}
|
||||
|
||||
//return a new instance of plugins
|
||||
function getPlugins(){
|
||||
var plugins = $p.plugins,
|
||||
f = function(){};
|
||||
f.prototype = plugins;
|
||||
|
||||
// do not overwrite functions if external definition
|
||||
f.prototype.compile = plugins.compile || compile;
|
||||
f.prototype.render = plugins.render || render;
|
||||
f.prototype.autoRender = plugins.autoRender || autoRender;
|
||||
f.prototype.find = plugins.find || find;
|
||||
|
||||
// give the compiler and the error handling to the plugin context
|
||||
f.prototype._compiler = compiler;
|
||||
f.prototype._error = error;
|
||||
|
||||
return new f();
|
||||
}
|
||||
|
||||
// returns the outer HTML of a node
|
||||
function outerHTML(node){
|
||||
// if IE take the internal method otherwise build one
|
||||
return node.outerHTML || (
|
||||
function(n){
|
||||
var div = document.createElement('div'), h;
|
||||
div.appendChild( n.cloneNode(true) );
|
||||
h = div.innerHTML;
|
||||
div = null;
|
||||
return h;
|
||||
})(node);
|
||||
}
|
||||
|
||||
// check if the argument is an array
|
||||
function isArray(o){
|
||||
return Object.prototype.toString.call( o ) === "[object Array]";
|
||||
}
|
||||
|
||||
// returns the string generator function
|
||||
function wrapquote(qfn, f){
|
||||
return function(ctxt){
|
||||
return qfn('' + f.call(ctxt.context, ctxt));
|
||||
};
|
||||
}
|
||||
|
||||
// convert a JSON HTML structure to a dom node and returns the leaf
|
||||
function domify(ns, pa){
|
||||
pa = pa || document.createDocumentFragment();
|
||||
var nn, leaf;
|
||||
for(var n in ns){
|
||||
nn = document.createElement(n);
|
||||
pa.appendChild(nn);
|
||||
if(typeof ns[n] === 'object'){
|
||||
leaf = domify(ns[n], nn);
|
||||
}else{
|
||||
leaf = document.createElement(ns[n]);
|
||||
nn.appendChild(leaf);
|
||||
}
|
||||
}
|
||||
return leaf;
|
||||
};
|
||||
|
||||
// default find using querySelector when available on the browser
|
||||
function find(n, sel){
|
||||
if(typeof n === 'string'){
|
||||
sel = n;
|
||||
n = false;
|
||||
}
|
||||
if(typeof document.querySelectorAll !== 'undefined'){
|
||||
return (n||document).querySelectorAll( sel );
|
||||
}else{
|
||||
error('You can test PURE standalone with: iPhone, FF3.5+, Safari4+ and IE8+\n\nTo run PURE on your browser, you need a JS library/framework with a CSS selector engine');
|
||||
}
|
||||
}
|
||||
|
||||
// create a function that concatenates constant string
|
||||
// sections (given in parts) and the results of called
|
||||
// functions to fill in the gaps between parts (fns).
|
||||
// fns[n] fills in the gap between parts[n-1] and parts[n];
|
||||
// fns[0] is unused.
|
||||
// this is the inner template evaluation loop.
|
||||
function concatenator(parts, fns){
|
||||
return function(ctxt){
|
||||
var strs = [ parts[ 0 ] ],
|
||||
n = parts.length,
|
||||
fnVal, pVal, attLine, pos;
|
||||
|
||||
for(var i = 1; i < n; i++){
|
||||
fnVal = fns[i]( ctxt );
|
||||
pVal = parts[i];
|
||||
|
||||
// if the value is empty and attribute, remove it
|
||||
if(fnVal === ''){
|
||||
attLine = strs[ strs.length - 1 ];
|
||||
if( ( pos = attLine.search( /[\w]+=\"?$/ ) ) > -1){
|
||||
strs[ strs.length - 1 ] = attLine.substring( 0, pos );
|
||||
pVal = pVal.substr( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
strs[ strs.length ] = fnVal;
|
||||
strs[ strs.length ] = pVal;
|
||||
}
|
||||
return strs.join('');
|
||||
};
|
||||
}
|
||||
|
||||
// parse and check the loop directive
|
||||
function parseloopspec(p){
|
||||
var m = p.match( /^(\w+)\s*<-\s*(\S+)?$/ );
|
||||
if(m === null){
|
||||
error('bad loop spec: "' + p + '"');
|
||||
}
|
||||
if(m[1] === 'item'){
|
||||
error('"item<-..." is a reserved word for the current running iteration.\n\nPlease choose another name for your loop.');
|
||||
}
|
||||
if( !m[2] || (m[2] && (/context/i).test(m[2]))){ //undefined or space(IE)
|
||||
m[2] = function(ctxt){return ctxt.context;};
|
||||
}
|
||||
return {name: m[1], sel: m[2]};
|
||||
}
|
||||
|
||||
// parse a data selector and return a function that
|
||||
// can traverse the data accordingly, given a context.
|
||||
function dataselectfn(sel){
|
||||
if(typeof(sel) === 'function'){
|
||||
return sel;
|
||||
}
|
||||
//check for a valid js variable name with hyphen(for properties only) and $
|
||||
var m = sel.match(/^[a-zA-Z$_][\w$]*(\.[\w$-]*[^\.])*$/);
|
||||
if(m === null){
|
||||
var found = false, s = sel, parts = [], pfns = [], i = 0, retStr;
|
||||
// check if literal
|
||||
if(/\'|\"/.test( s.charAt(0) )){
|
||||
if(/\'|\"/.test( s.charAt(s.length-1) )){
|
||||
retStr = s.substring(1, s.length-1);
|
||||
return function(){ return retStr; };
|
||||
}
|
||||
}else{
|
||||
// check if literal + #{var}
|
||||
while((m = s.match(/#\{([^{}]+)\}/)) !== null){
|
||||
found = true;
|
||||
parts[i++] = s.slice(0, m.index);
|
||||
pfns[i] = dataselectfn(m[1]);
|
||||
s = s.slice(m.index + m[0].length, s.length);
|
||||
}
|
||||
}
|
||||
if(!found){
|
||||
error('bad data selector syntax: ' + sel);
|
||||
}
|
||||
parts[i] = s;
|
||||
return concatenator(parts, pfns);
|
||||
}
|
||||
m = sel.split('.');
|
||||
return function(ctxt){
|
||||
var data = ctxt.context;
|
||||
if(!data){
|
||||
return '';
|
||||
}
|
||||
var v = ctxt[m[0]],
|
||||
i = 0;
|
||||
if(v && v.item){
|
||||
data = v.item;
|
||||
i += 1;
|
||||
}
|
||||
var n = m.length;
|
||||
for(; i < n; i++){
|
||||
if(!data){break;}
|
||||
data = data[m[i]];
|
||||
}
|
||||
return (!data && data !== 0) ? '':data;
|
||||
};
|
||||
}
|
||||
|
||||
// wrap in an object the target node/attr and their properties
|
||||
function gettarget(dom, sel, isloop){
|
||||
var osel, prepend, selector, attr, append, target = [];
|
||||
if( typeof sel === 'string' ){
|
||||
osel = sel;
|
||||
var m = sel.match(selRx);
|
||||
if( !m ){
|
||||
error( 'bad selector syntax: ' + sel );
|
||||
}
|
||||
|
||||
prepend = m[1];
|
||||
selector = m[2];
|
||||
attr = m[3];
|
||||
append = m[4];
|
||||
|
||||
if(selector === '.' || ( !selector && attr ) ){
|
||||
target[0] = dom;
|
||||
}else{
|
||||
target = plugins.find(dom, selector);
|
||||
}
|
||||
if(!target || target.length === 0){
|
||||
return error('The node "' + sel + '" was not found in the template');
|
||||
}
|
||||
}else{
|
||||
// autoRender node
|
||||
prepend = sel.prepend;
|
||||
attr = sel.attr;
|
||||
append = sel.append;
|
||||
target = [dom];
|
||||
}
|
||||
|
||||
if( prepend || append ){
|
||||
if( prepend && append ){
|
||||
error('append/prepend cannot take place at the same time');
|
||||
}else if( isloop ){
|
||||
error('no append/prepend/replace modifiers allowed for loop target');
|
||||
}else if( append && isloop ){
|
||||
error('cannot append with loop (sel: ' + osel + ')');
|
||||
}
|
||||
}
|
||||
var setstr, getstr, quotefn, isStyle, isClass, attName;
|
||||
if(attr){
|
||||
isStyle = (/^style$/i).test(attr);
|
||||
isClass = (/^class$/i).test(attr);
|
||||
attName = isClass ? 'className' : attr;
|
||||
setstr = function(node, s) {
|
||||
node.setAttribute(attPfx + attr, s);
|
||||
if (attName in node && !isStyle) {
|
||||
node[attName] = '';
|
||||
}
|
||||
if (node.nodeType === 1) {
|
||||
node.removeAttribute(attr);
|
||||
isClass && node.removeAttribute(attName);
|
||||
}
|
||||
};
|
||||
if(isStyle) {
|
||||
getstr = function(node){ return node.style.cssText; };
|
||||
}else if(isClass) {
|
||||
getstr = function(node){ return node.className; };
|
||||
}else{
|
||||
getstr = function(node){ return node.getAttribute(attr); };
|
||||
}
|
||||
if (isStyle || isClass) {//IE no quotes special care
|
||||
quotefn = function(s){ return s.replace(/\"/g, '"'); };
|
||||
}else {
|
||||
quotefn = function(s){ return s.replace(/\"/g, '"').replace(/\s/g, ' '); };
|
||||
}
|
||||
}else{
|
||||
if(isloop){
|
||||
setstr = function(node, s){
|
||||
// we can have a null parent node
|
||||
// if we get overlapping targets.
|
||||
var pn = node.parentNode;
|
||||
if(pn){
|
||||
//replace node with s
|
||||
pn.insertBefore( document.createTextNode( s ), node.nextSibling );
|
||||
pn.removeChild( node );
|
||||
}
|
||||
};
|
||||
}else{
|
||||
getstr = function(node){
|
||||
return node.innerHTML;
|
||||
};
|
||||
setstr = function(node, s, ap){
|
||||
if(ap === true){
|
||||
node.innerHTML = s;
|
||||
}else{
|
||||
node.innerHTML = '';
|
||||
node.appendChild( document.createTextNode( s ));
|
||||
}
|
||||
};
|
||||
}
|
||||
quotefn = function(s){
|
||||
return s;
|
||||
};
|
||||
}
|
||||
var setfn;
|
||||
if(prepend){
|
||||
setfn = function(node, s){
|
||||
setstr( node, s + getstr( node ) , true);
|
||||
};
|
||||
}else if(append){
|
||||
setfn = function(node, s){
|
||||
setstr( node, getstr( node ) + s , true);
|
||||
};
|
||||
}else{
|
||||
setfn = function(node, s){
|
||||
setstr( node, s );
|
||||
};
|
||||
}
|
||||
return {attr: attr, nodes: target, set: setfn, sel: osel, quotefn: quotefn};
|
||||
}
|
||||
|
||||
function setsig(target, n){
|
||||
var sig = Sig + n + ':';
|
||||
for(var i = 0; i < target.nodes.length; i++){
|
||||
// could check for overlapping targets here.
|
||||
target.set( target.nodes[i], sig );
|
||||
}
|
||||
}
|
||||
|
||||
// read de loop data, and pass it to the inner rendering function
|
||||
function loopfn(name, dselect, inner, sorter){
|
||||
return function(ctxt){
|
||||
var a = dselect(ctxt),
|
||||
old = ctxt[name],
|
||||
temp = { items : a },
|
||||
strs = [],
|
||||
buildArg = function(idx, temp){
|
||||
ctxt.pos = temp.pos = idx;
|
||||
ctxt.item = temp.item = a[ idx ];
|
||||
ctxt.items = a;
|
||||
strs.push( inner.call(temp, ctxt ) );
|
||||
};
|
||||
ctxt[name] = temp;
|
||||
if( isArray(a) ){
|
||||
if(typeof sorter !== 'undefined'){
|
||||
a.sort(sorter);
|
||||
}
|
||||
//loop on array
|
||||
for(var i = 0, ii = a.length || 0; i < ii; i++){
|
||||
buildArg(i, temp);
|
||||
}
|
||||
}else{
|
||||
if(typeof sorter !== 'undefined'){
|
||||
error('sort is only available on arrays, not objects');
|
||||
}
|
||||
//loop on collections
|
||||
for(var prop in a){
|
||||
a.hasOwnProperty( prop ) && buildArg(prop, temp);
|
||||
}
|
||||
}
|
||||
|
||||
typeof old !== 'undefined' ? ctxt[name] = old : delete ctxt[name];
|
||||
return strs.join('');
|
||||
};
|
||||
}
|
||||
// generate the template for a loop node
|
||||
function loopgen(dom, sel, loop, fns){
|
||||
var already = false, ls, sorter, prop;
|
||||
for(prop in loop){
|
||||
if(loop.hasOwnProperty(prop)){
|
||||
if(prop === 'sort'){
|
||||
sorter = loop.sort;
|
||||
continue;
|
||||
}
|
||||
if(already){
|
||||
error('cannot have more than one loop on a target');
|
||||
}
|
||||
ls = prop;
|
||||
already = true;
|
||||
}
|
||||
}
|
||||
if(!ls){
|
||||
error('no loop spec');
|
||||
}
|
||||
var dsel = loop[ls];
|
||||
// if it's a simple data selector then we default to contents, not replacement.
|
||||
if(typeof(dsel) === 'string' || typeof(dsel) === 'function'){
|
||||
loop = {};
|
||||
loop[ls] = {root: dsel};
|
||||
return loopgen(dom, sel, loop, fns);
|
||||
}
|
||||
var spec = parseloopspec(ls),
|
||||
itersel = dataselectfn(spec.sel),
|
||||
target = gettarget(dom, sel, true),
|
||||
nodes = target.nodes;
|
||||
|
||||
for(i = 0; i < nodes.length; i++){
|
||||
var node = nodes[i],
|
||||
inner = compiler(node, dsel);
|
||||
fns[fns.length] = wrapquote(target.quotefn, loopfn(spec.name, itersel, inner, sorter));
|
||||
target.nodes = [node]; // N.B. side effect on target.
|
||||
setsig(target, fns.length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
function getAutoNodes(n, data){
|
||||
var ns = n.getElementsByTagName('*'),
|
||||
an = [],
|
||||
openLoops = {a:[],l:{}},
|
||||
cspec,
|
||||
isNodeValue,
|
||||
i, ii, j, jj, ni, cs, cj;
|
||||
//for each node found in the template
|
||||
for(i = -1, ii = ns.length; i < ii; i++){
|
||||
ni = i > -1 ?ns[i]:n;
|
||||
if(ni.nodeType === 1 && ni.className !== ''){
|
||||
//when a className is found
|
||||
cs = ni.className.split(' ');
|
||||
// for each className
|
||||
for(j = 0, jj=cs.length;j<jj;j++){
|
||||
cj = cs[j];
|
||||
// check if it is related to a context property
|
||||
cspec = checkClass(cj, ni.tagName);
|
||||
// if so, store the node, plus the type of data
|
||||
if(cspec !== false){
|
||||
isNodeValue = (/nodevalue/i).test(cspec.attr);
|
||||
if(cspec.sel.indexOf('@') > -1 || isNodeValue){
|
||||
ni.className = ni.className.replace('@'+cspec.attr, '');
|
||||
if(isNodeValue){
|
||||
cspec.attr = false;
|
||||
}
|
||||
}
|
||||
an.push({n:ni, cspec:cspec});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return an;
|
||||
|
||||
function checkClass(c, tagName){
|
||||
// read the class
|
||||
var ca = c.match(selRx),
|
||||
attr = ca[3] || autoAttr[tagName],
|
||||
cspec = {prepend:!!ca[1], prop:ca[2], attr:attr, append:!!ca[4], sel:c},
|
||||
i, ii, loopi, loopil, val;
|
||||
// check in existing open loops
|
||||
for(i = openLoops.a.length-1; i >= 0; i--){
|
||||
loopi = openLoops.a[i];
|
||||
loopil = loopi.l[0];
|
||||
val = loopil && loopil[cspec.prop];
|
||||
if(typeof val !== 'undefined'){
|
||||
cspec.prop = loopi.p + '.' + cspec.prop;
|
||||
if(openLoops.l[cspec.prop] === true){
|
||||
val = val[0];
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
// not found check first level of data
|
||||
if(typeof val === 'undefined'){
|
||||
val = isArray(data) ? data[0][cspec.prop] : data[cspec.prop];
|
||||
// nothing found return
|
||||
if(typeof val === 'undefined'){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
// set the spec for autoNode
|
||||
if(isArray(val)){
|
||||
openLoops.a.push( {l:val, p:cspec.prop} );
|
||||
openLoops.l[cspec.prop] = true;
|
||||
cspec.t = 'loop';
|
||||
}else{
|
||||
cspec.t = 'str';
|
||||
}
|
||||
return cspec;
|
||||
}
|
||||
}
|
||||
|
||||
// returns a function that, given a context argument,
|
||||
// will render the template defined by dom and directive.
|
||||
function compiler(dom, directive, data, ans){
|
||||
var fns = [];
|
||||
// autoRendering nodes parsing -> auto-nodes
|
||||
ans = ans || data && getAutoNodes(dom, data);
|
||||
if(data){
|
||||
var j, jj, cspec, n, target, nodes, itersel, node, inner;
|
||||
// for each auto-nodes
|
||||
while(ans.length > 0){
|
||||
cspec = ans[0].cspec;
|
||||
n = ans[0].n;
|
||||
ans.splice(0, 1);
|
||||
if(cspec.t === 'str'){
|
||||
// if the target is a value
|
||||
target = gettarget(n, cspec, false);
|
||||
setsig(target, fns.length);
|
||||
fns[fns.length] = wrapquote(target.quotefn, dataselectfn(cspec.prop));
|
||||
}else{
|
||||
// if the target is a loop
|
||||
itersel = dataselectfn(cspec.sel);
|
||||
target = gettarget(n, cspec, true);
|
||||
nodes = target.nodes;
|
||||
for(j = 0, jj = nodes.length; j < jj; j++){
|
||||
node = nodes[j];
|
||||
inner = compiler(node, false, data, ans);
|
||||
fns[fns.length] = wrapquote(target.quotefn, loopfn(cspec.sel, itersel, inner));
|
||||
target.nodes = [node];
|
||||
setsig(target, fns.length - 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// read directives
|
||||
var target, dsel;
|
||||
for(var sel in directive){
|
||||
if(directive.hasOwnProperty(sel)){
|
||||
dsel = directive[sel];
|
||||
if(typeof(dsel) === 'function' || typeof(dsel) === 'string'){
|
||||
// set the value for the node/attr
|
||||
target = gettarget(dom, sel, false);
|
||||
setsig(target, fns.length);
|
||||
fns[fns.length] = wrapquote(target.quotefn, dataselectfn(dsel));
|
||||
}else{
|
||||
// loop on node
|
||||
loopgen(dom, sel, dsel, fns);
|
||||
}
|
||||
}
|
||||
}
|
||||
// convert node to a string
|
||||
var h = outerHTML(dom), pfns = [];
|
||||
// IE adds an unremovable "selected, value" attribute
|
||||
// hard replace while waiting for a better solution
|
||||
h = h.replace(/<([^>]+)\s(value\=""|selected)\s?([^>]*)>/ig, "<$1 $3>");
|
||||
|
||||
// remove attribute prefix
|
||||
h = h.split(attPfx).join('');
|
||||
|
||||
// slice the html string at "Sig"
|
||||
var parts = h.split( Sig ), p;
|
||||
// for each slice add the return string of
|
||||
for(var i = 1; i < parts.length; i++){
|
||||
p = parts[i];
|
||||
// part is of the form "fn-number:..." as placed there by setsig.
|
||||
pfns[i] = fns[ parseInt(p, 10) ];
|
||||
parts[i] = p.substring( p.indexOf(':') + 1 );
|
||||
}
|
||||
return concatenator(parts, pfns);
|
||||
}
|
||||
// compile the template with directive
|
||||
// if a context is passed, the autoRendering is triggered automatically
|
||||
// return a function waiting the data as argument
|
||||
function compile(directive, ctxt, template){
|
||||
var rfn = compiler( ( template || this[0] ).cloneNode(true), directive, ctxt);
|
||||
return function(context){
|
||||
return rfn({context:context});
|
||||
};
|
||||
}
|
||||
//compile with the directive as argument
|
||||
// run the template function on the context argument
|
||||
// return an HTML string
|
||||
// should replace the template and return this
|
||||
function render(ctxt, directive){
|
||||
var fn = typeof directive === 'function' ? directive : plugins.compile( directive, false, this[0] );
|
||||
for(var i = 0, ii = this.length; i < ii; i++){
|
||||
this[i] = replaceWith( this[i], fn( ctxt, false ));
|
||||
}
|
||||
context = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
// compile the template with autoRender
|
||||
// run the template function on the context argument
|
||||
// return an HTML string
|
||||
function autoRender(ctxt, directive){
|
||||
var fn = plugins.compile( directive, ctxt, this[0] );
|
||||
for(var i = 0, ii = this.length; i < ii; i++){
|
||||
this[i] = replaceWith( this[i], fn( ctxt, false));
|
||||
}
|
||||
context = null;
|
||||
return this;
|
||||
}
|
||||
|
||||
function replaceWith(elm, html){
|
||||
var tagName = elm.tagName, ne, pa, ep, parent = {TABLE:{}};
|
||||
if((/TD|TR|TH/).test(tagName)){
|
||||
var parents = { TR:{TABLE:'TBODY'}, TD:{TABLE:{TBODY:'TR'}}, TH:{TABLE:{THEAD:'TR'}} };
|
||||
pa = domify( parents[ tagName ] );
|
||||
}else if( ( /TBODY|THEAD|TFOOT/ ).test( tagName )){
|
||||
pa = document.createElement('TABLE');
|
||||
}else{
|
||||
pa = document.createElement('SPAN');
|
||||
}
|
||||
|
||||
ep = elm.parentNode;
|
||||
// avoid IE mem leak
|
||||
ep.insertBefore(pa, elm);
|
||||
ep.removeChild(elm);
|
||||
// pa.style.display = 'none';
|
||||
pa.innerHTML = html;
|
||||
ne = pa.firstChild;
|
||||
ep.insertBefore(ne, pa);
|
||||
ep.removeChild(pa);
|
||||
elm = ne;
|
||||
|
||||
pa = ne = ep = null;
|
||||
return elm;
|
||||
}
|
||||
};
|
||||
|
||||
$p.plugins = {};
|
||||
|
||||
$p.libs = {
|
||||
dojo:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return dojo.query(sel, n);
|
||||
};
|
||||
}
|
||||
},
|
||||
domassistant:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return $(n).cssSelect(sel);
|
||||
};
|
||||
}
|
||||
DOMAssistant.attach({
|
||||
publicMethods : [ 'compile', 'render', 'autoRender'],
|
||||
compile:function(directive, ctxt){ return $p(this).compile(directive, ctxt); },
|
||||
render:function(ctxt, directive){ return $( $p(this).render(ctxt, directive) )[0]; },
|
||||
autoRender:function(ctxt, directive){ return $( $p(this).autoRender(ctxt, directive) )[0]; }
|
||||
});
|
||||
},
|
||||
jquery:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return $(n).find(sel);
|
||||
};
|
||||
}
|
||||
jQuery.fn.extend({
|
||||
compile:function(directive, ctxt){ return $p(this[0]).compile(directive, ctxt); },
|
||||
render:function(ctxt, directive){ return jQuery( $p( this[0] ).render( ctxt, directive ) ); },
|
||||
autoRender:function(ctxt, directive){ return jQuery( $p( this[0] ).autoRender( ctxt, directive ) ); }
|
||||
});
|
||||
},
|
||||
mootools:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return $(n).getElements(sel);
|
||||
};
|
||||
}
|
||||
Element.implement({
|
||||
compile:function(directive, ctxt){ return $p(this).compile(directive, ctxt); },
|
||||
render:function(ctxt, directive){ return $p(this).render(ctxt, directive); },
|
||||
autoRender:function(ctxt, directive){ return $p(this).autoRender(ctxt, directive); }
|
||||
});
|
||||
},
|
||||
prototype:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
n = n === document ? n.body : n;
|
||||
return typeof n === 'string' ? $$(n) : $(n).select(sel);
|
||||
};
|
||||
}
|
||||
Element.addMethods({
|
||||
compile:function(element, directive, ctxt){ return $p(element).compile(directive, ctxt); },
|
||||
render:function(element, ctxt, directive){ return $p(element).render(ctxt, directive); },
|
||||
autoRender:function(element, ctxt, directive){ return $p(element).autoRender(ctxt, directive); }
|
||||
});
|
||||
},
|
||||
sizzle:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return window.Sizzle(sel, n);
|
||||
};
|
||||
}
|
||||
},
|
||||
sly:function(){
|
||||
if(typeof document.querySelector === 'undefined'){
|
||||
$p.plugins.find = function(n, sel){
|
||||
return Sly(sel, n);
|
||||
};
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// get lib specifics if available
|
||||
(function(){
|
||||
var libkey =
|
||||
typeof dojo !== 'undefined' && 'dojo' ||
|
||||
typeof DOMAssistant !== 'undefined' && 'domassistant' ||
|
||||
typeof jQuery !== 'undefined' && 'jquery' ||
|
||||
typeof MooTools !== 'undefined' && 'mootools' ||
|
||||
typeof Prototype !== 'undefined' && 'prototype' ||
|
||||
typeof window.Sizzle !== 'undefined' && 'sizzle' ||
|
||||
typeof Sly !== 'undefined' && 'sly';
|
||||
|
||||
libkey && $p.libs[libkey]();
|
||||
})();
|
||||
return pure;
|
||||
};
|
||||
|
96
bower_components/jsdom/example/pure/run.js
vendored
96
bower_components/jsdom/example/pure/run.js
vendored
@ -1,96 +0,0 @@
|
||||
var browser = require("../../lib/jsdom/browser/index");
|
||||
var dom = new browser.browserAugmentation(require("../../lib/jsdom/level2/html").dom.level2.html);
|
||||
var sax = require("./sax");
|
||||
var util = require('util');
|
||||
|
||||
|
||||
// TODO: change this example to use pluggable parser
|
||||
|
||||
/**
|
||||
setup innerHTML setter
|
||||
*/
|
||||
dom.Element.prototype.__defineSetter__('innerHTML', function(html) {
|
||||
|
||||
|
||||
// first remove all the children
|
||||
for (var i=this.childNodes.length-1; i>=0;i--)
|
||||
{
|
||||
this.removeChild(this.childNodes.item(i));
|
||||
}
|
||||
|
||||
var currentElement = this, currentLevel = 0;
|
||||
|
||||
/**
|
||||
setup sax parser
|
||||
*/
|
||||
parser = sax.parser(false);
|
||||
|
||||
parser.onerror = function (e) {
|
||||
|
||||
};
|
||||
parser.ontext = function (t) {
|
||||
|
||||
var ownerDocument = currentElement.ownerDocument || currentElement;
|
||||
var newText = ownerDocument.createTextNode(t);
|
||||
currentElement.appendChild(newText);
|
||||
};
|
||||
parser.onopentag = function (node) {
|
||||
var nodeName = node.name.toLowerCase(),
|
||||
document = currentElement.ownerDocument || currentElement,
|
||||
newElement = document.createElement(nodeName),
|
||||
i = 0,
|
||||
length = (node.attributes && node.attributes.length) ?
|
||||
node.attributes.length :
|
||||
0;
|
||||
|
||||
for (i in node.attributes)
|
||||
{
|
||||
if (node.attributes.hasOwnProperty(i)) {
|
||||
newElement.setAttribute(i, node.attributes[i]);
|
||||
}
|
||||
}
|
||||
currentElement.appendChild(newElement);
|
||||
currentElement = newElement;
|
||||
};
|
||||
parser.onclosetag = function(node) {
|
||||
currentElement = currentElement.parentNode;
|
||||
}
|
||||
|
||||
parser.write(html).close();
|
||||
});
|
||||
|
||||
|
||||
|
||||
var doc = new dom.Document("html");
|
||||
|
||||
var implementation = new dom.DOMImplementation(doc, {
|
||||
"HTML" : "1.0",
|
||||
"DisableLiveLists" : "1.0"
|
||||
});
|
||||
|
||||
var notations = new dom.NotationNodeMap(
|
||||
doc,
|
||||
doc.createNotationNode("notation1","notation1File", null),
|
||||
doc.createNotationNode("notation2",null, "notation2File")
|
||||
);
|
||||
|
||||
var entities = new dom.EntityNodeMap(doc);
|
||||
|
||||
var doctype = new dom.DocumentType(doc, "html", entities, notations);
|
||||
doc.doctype = doctype;
|
||||
doc.implementation = implementation;
|
||||
|
||||
doc.innerHTML = '<html><head></head><body><div class="who"></div></body></html>';
|
||||
|
||||
var window = {
|
||||
alert : function() { console.log(util.inspect(arguments)); },
|
||||
document : doc
|
||||
};
|
||||
|
||||
window.Sizzle = require("../sizzle/sizzle").sizzleInit(window, doc);
|
||||
var $ = require("./pure").pureInit(window, doc);
|
||||
$("div").autoRender({"who":"Hello Wrrrld"});
|
||||
console.log(doc.innerHTML);
|
||||
|
||||
|
||||
|
11
bower_components/jsdom/example/pure/sax-test.js
vendored
11
bower_components/jsdom/example/pure/sax-test.js
vendored
@ -1,11 +0,0 @@
|
||||
var util = require("util"),
|
||||
sax = require("./sax");
|
||||
|
||||
|
||||
parser = sax.parser(false);
|
||||
|
||||
sax.EVENTS.forEach(function (ev) {
|
||||
parser["on" + ev] = function() { console.log(util.inspect(arguments)); };
|
||||
});
|
||||
|
||||
parser.write("<span>Welcome,</span> to monkey land").close();
|
535
bower_components/jsdom/example/pure/sax.js
vendored
535
bower_components/jsdom/example/pure/sax.js
vendored
@ -1,535 +0,0 @@
|
||||
var sax = exports;
|
||||
sax.parser = function (strict, opt) { return new SAXParser(strict, opt) };
|
||||
sax.SAXParser = SAXParser;
|
||||
|
||||
function SAXParser (strict, opt) {
|
||||
this.c = this.comment = this.sgmlDecl =
|
||||
this.textNode = this.tagName = this.doctype =
|
||||
this.procInstName = this.procInstBody = this.entity =
|
||||
this.attribName = this.attribValue = this.q =
|
||||
this.cdata = this.sgmlDecl = "";
|
||||
this.opt = opt || {};
|
||||
this.tagCase = this.opt.lowercasetags ? "toLowerCase" : "toUpperCase";
|
||||
this.tags = [];
|
||||
this.closed = this.closedRoot = this.sawRoot = false;
|
||||
this.tag = this.error = null;
|
||||
this.strict = !!strict;
|
||||
this.state = S.BEGIN;
|
||||
this.ENTITIES = Object.create(sax.ENTITIES);
|
||||
|
||||
// just for error reporting
|
||||
this.position = this.line = this.column = 0;
|
||||
emit(this, "onready");
|
||||
}
|
||||
SAXParser.prototype = {
|
||||
write : write,
|
||||
resume : function () { this.error = null; return this },
|
||||
close : function () { return this.write(null) },
|
||||
}
|
||||
|
||||
// character classes and tokens
|
||||
var whitespace = "\n\t ",
|
||||
// this really needs to be replaced with character classes.
|
||||
// XML allows all manner of ridiculous numbers and digits.
|
||||
number = "0124356789",
|
||||
letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
// (Letter | '_' | ':')
|
||||
nameStart = letter+"_:",
|
||||
nameBody = nameStart+number+"-.",
|
||||
quote = "'\"",
|
||||
entity = number+letter+"#",
|
||||
CDATA = "[CDATA[",
|
||||
DOCTYPE = "DOCTYPE";
|
||||
function is (charclass, c) { return charclass.indexOf(c) !== -1 }
|
||||
function not (charclass, c) { return !is(charclass, c) }
|
||||
|
||||
var S = 0;
|
||||
sax.STATE =
|
||||
{ BEGIN : S++
|
||||
, TEXT : S++ // general stuff
|
||||
, TEXT_ENTITY : S++ // & and such.
|
||||
, OPEN_WAKA : S++ // <
|
||||
, SGML_DECL : S++ // <!BLARG
|
||||
, SGML_DECL_QUOTED : S++ // <!BLARG foo "bar
|
||||
, DOCTYPE : S++ // <!DOCTYPE
|
||||
, DOCTYPE_QUOTED : S++ // <!DOCTYPE "//blah
|
||||
, DOCTYPE_DTD : S++ // <!DOCTYPE "//blah" [ ...
|
||||
, DOCTYPE_DTD_QUOTED : S++ // <!DOCTYPE "//blah" [ "foo
|
||||
, COMMENT_STARTING : S++ // <!-
|
||||
, COMMENT : S++ // <!--
|
||||
, COMMENT_ENDING : S++ // <!-- blah -
|
||||
, COMMENT_ENDED : S++ // <!-- blah --
|
||||
, CDATA : S++ // <![CDATA[ something
|
||||
, CDATA_ENDING : S++ // ]
|
||||
, CDATA_ENDING_2 : S++ // ]]
|
||||
, PROC_INST : S++ // <?hi
|
||||
, PROC_INST_BODY : S++ // <?hi there
|
||||
, PROC_INST_QUOTED : S++ // <?hi there
|
||||
, PROC_INST_ENDING : S++ // <?hi there ?
|
||||
, OPEN_TAG : S++ // <strong
|
||||
, OPEN_TAG_SLASH : S++ // <strong /
|
||||
, ATTRIB : S++ // <a
|
||||
, ATTRIB_NAME : S++ // <a foo
|
||||
, ATTRIB_NAME_SAW_WHITE : S++ // <a foo _
|
||||
, ATTRIB_VALUE : S++ // <a foo="bar
|
||||
, ATTRIB_VALUE_QUOTED : S++ // <a foo="bar
|
||||
, ATTRIB_VALUE_UNQUOTED : S++ // <a foo="bar
|
||||
, ATTRIB_VALUE_ENTITY_Q : S++ // <foo bar="""
|
||||
, ATTRIB_VALUE_ENTITY_U : S++ // <foo bar="
|
||||
, CLOSE_TAG : S++ // </a
|
||||
, CLOSE_TAG_SAW_WHITE : S++ // </a >
|
||||
}
|
||||
|
||||
sax.ENTITIES =
|
||||
{ "apos" : "'"
|
||||
, "quot" : '"'
|
||||
, "amp" : "&"
|
||||
, "gt" : ">"
|
||||
, "lt" : "<"
|
||||
}
|
||||
|
||||
for (var S in sax.STATE) sax.STATE[sax.STATE[S]] = S;
|
||||
|
||||
// shorthand
|
||||
S = sax.STATE;
|
||||
sax.EVENTS = [ // for discoverability.
|
||||
"text", "processinginstruction", "sgmldeclaration",
|
||||
"doctype", "comment", "attribute", "opentag", "closetag",
|
||||
"cdata", "error", "end", "ready" ];
|
||||
|
||||
function emit (parser, event, data) {
|
||||
parser[event] && parser[event](data);
|
||||
}
|
||||
function emitNode (parser, nodeType, data) {
|
||||
if (parser.textNode) closeText(parser);
|
||||
emit(parser, nodeType, data);
|
||||
}
|
||||
function closeText (parser) {
|
||||
parser.textNode = textopts(parser.opt, parser.textNode);
|
||||
if (parser.textNode) emit(parser, "ontext", parser.textNode);
|
||||
parser.textNode = "";
|
||||
}
|
||||
function textopts (opt, text) {
|
||||
if (opt.trim) text = text.trim();
|
||||
if (opt.normalize) text = text.replace(/\s+/g, " ");
|
||||
return text;
|
||||
}
|
||||
function error (parser, er) {
|
||||
closeText(parser);
|
||||
er += "\nLine: "+parser.line+
|
||||
"\nColumn: "+parser.column+
|
||||
"\nChar: "+parser.c;
|
||||
er = new Error(er);
|
||||
parser.error = er;
|
||||
emit(parser, "onerror", er);
|
||||
return parser;
|
||||
}
|
||||
function end (parser) {
|
||||
if (parser.state !== S.TEXT) error(parser, "Unexpected end");
|
||||
closeText(parser);
|
||||
parser.c = "";
|
||||
parser.closed = true;
|
||||
emit(parser, "onend");
|
||||
SAXParser.call(parser, parser.strict, parser.opt);
|
||||
return parser;
|
||||
}
|
||||
function strictFail (parser, message) {
|
||||
if (parser.strict) error(parser, message);
|
||||
}
|
||||
function newTag (parser) {
|
||||
if (!parser.strict) parser.tagName = parser.tagName[parser.tagCase]();
|
||||
parser.tag = { name : parser.tagName, attributes : {} };
|
||||
}
|
||||
function openTag (parser) {
|
||||
parser.sawRoot = true;
|
||||
parser.tags.push(parser.tag);
|
||||
emitNode(parser, "onopentag", parser.tag);
|
||||
parser.tag = null;
|
||||
parser.tagName = parser.attribName = parser.attribValue = "";
|
||||
parser.state = S.TEXT;
|
||||
}
|
||||
function closeTag (parser) {
|
||||
if (!parser.tagName) {
|
||||
strictFail(parser, "Weird empty close tag.");
|
||||
parser.textNode += "</>";
|
||||
parser.state = S.TEXT;
|
||||
return;
|
||||
}
|
||||
do {
|
||||
if (!parser.strict) parser.tagName = parser.tagName[parser.tagCase]();
|
||||
var closeTo = parser.tagName, close = parser.tags.pop();
|
||||
if (!close) {
|
||||
throw "wtf "+parser.tagName+" "+parser.tags+" "+parser.line+ " "+parser.position;
|
||||
}
|
||||
if (closeTo !== close.name) strictFail(parser, "Unexpected close tag.");
|
||||
parser.tag = close;
|
||||
parser.tagName = close.name;
|
||||
emitNode(parser, "onclosetag", parser.tagName);
|
||||
} while (closeTo !== close.name);
|
||||
if (parser.tags.length === 0) parser.closedRoot = true;
|
||||
parser.tagName = parser.attribValue = parser.attribName = "";
|
||||
parser.tag = null;
|
||||
parser.state = S.TEXT;
|
||||
}
|
||||
function parseEntity (parser) {
|
||||
var entity = parser.entity.toLowerCase(), num, numStr = "";
|
||||
if (parser.ENTITIES[entity]) return parser.ENTITIES[entity];
|
||||
if (entity.charAt(0) === "#") {
|
||||
if (entity.charAt(1) === "x") {
|
||||
entity = entity.slice(2);
|
||||
num = parseInt(entity, 16), numStr = num.toString(16);
|
||||
} else {
|
||||
entity = entity.slice(1);
|
||||
num = parseInt(entity, 10), numStr = num.toString(10);
|
||||
}
|
||||
}
|
||||
if (numStr.toLowerCase() !== entity) {
|
||||
strictFail(parser, "Invalid character entity");
|
||||
return "&"+parser.entity + ";";
|
||||
}
|
||||
return String.fromCharCode(num);
|
||||
}
|
||||
|
||||
function write (chunk) {
|
||||
var parser = this;
|
||||
if (this.error) throw this.error;
|
||||
if (parser.closed) return error(parser,
|
||||
"Cannot write after close. Assign an onready handler.");
|
||||
if (chunk === null) return end(parser);
|
||||
var i = 0, c = ""
|
||||
while (parser.c = c = chunk.charAt(i++)) {
|
||||
parser.position ++;
|
||||
if (c === "\n") {
|
||||
parser.line ++;
|
||||
parser.column = 0;
|
||||
} else parser.column ++;
|
||||
switch (parser.state) {
|
||||
case S.BEGIN:
|
||||
if (c === "<") parser.state = S.OPEN_WAKA;
|
||||
else if (not(whitespace,c)) {
|
||||
// have to process this as a text node.
|
||||
// weird, but happens.
|
||||
strictFail(parser, "Non-whitespace before first tag.");
|
||||
parser.textNode = c;
|
||||
state = S.TEXT;
|
||||
}
|
||||
continue;
|
||||
case S.TEXT:
|
||||
if (c === "<") parser.state = S.OPEN_WAKA;
|
||||
else {
|
||||
if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot))
|
||||
strictFail("Text data outside of root node.");
|
||||
if (c === "&") parser.state = S.TEXT_ENTITY;
|
||||
else parser.textNode += c;
|
||||
}
|
||||
continue;
|
||||
case S.OPEN_WAKA:
|
||||
// either a /, ?, !, or text is coming next.
|
||||
if (c === "!") {
|
||||
parser.state = S.SGML_DECL;
|
||||
parser.sgmlDecl = "";
|
||||
} else if (is(whitespace, c)) {
|
||||
// wait for it...
|
||||
} else if (is(nameStart,c)) {
|
||||
parser.state = S.OPEN_TAG;
|
||||
parser.tagName = c;
|
||||
} else if (c === "/") {
|
||||
parser.state = S.CLOSE_TAG;
|
||||
parser.tagName = "";
|
||||
} else if (c === "?") {
|
||||
parser.state = S.PROC_INST;
|
||||
parser.procInstName = parser.procInstBody = "";
|
||||
} else {
|
||||
strictFail(parser, "Unencoded <");
|
||||
parser.textNode += "<" + c;
|
||||
parser.state = S.TEXT;
|
||||
}
|
||||
continue;
|
||||
case S.SGML_DECL:
|
||||
if ((parser.sgmlDecl+c).toUpperCase() === CDATA) {
|
||||
parser.state = S.CDATA;
|
||||
parser.sgmlDecl = "";
|
||||
parser.cdata = "";
|
||||
} else if (parser.sgmlDecl+c === "--") {
|
||||
parser.state = S.COMMENT;
|
||||
parser.comment = "";
|
||||
parser.sgmlDecl = "";
|
||||
} else if ((parser.sgmlDecl+c).toUpperCase() === DOCTYPE) {
|
||||
parser.state = S.DOCTYPE;
|
||||
if (parser.doctype || parser.sawRoot) strictFail(parser,
|
||||
"Inappropriately located doctype declaration");
|
||||
parser.doctype = "";
|
||||
parser.sgmlDecl = "";
|
||||
} else if (c === ">") {
|
||||
emitNode(parser, "onsgmldeclaration", parser.sgmlDecl);
|
||||
parser.sgmlDecl = "";
|
||||
parser.state = S.TEXT;
|
||||
} else if (is(quote, c)) {
|
||||
parser.state = S.SGML_DECL_QUOTED;
|
||||
parser.sgmlDecl += c;
|
||||
} else parser.sgmlDecl += c;
|
||||
continue;
|
||||
case S.SGML_DECL_QUOTED:
|
||||
if (c === parser.q) {
|
||||
parser.state = S.SGML_DECL;
|
||||
parser.q = "";
|
||||
}
|
||||
parser.sgmlDecl += c;
|
||||
continue;
|
||||
case S.DOCTYPE:
|
||||
if (c === ">") {
|
||||
parser.state = S.TEXT;
|
||||
emitNode(parser, "ondoctype", parser.doctype);
|
||||
parser.doctype = true; // just remember that we saw it.
|
||||
} else {
|
||||
parser.doctype += c;
|
||||
if (c === "[") parser.state = S.DOCTYPE_DTD;
|
||||
else if (is(quote, c)) {
|
||||
parser.state = S.DOCTYPE_QUOTED;
|
||||
parser.q = c;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case S.DOCTYPE_QUOTED:
|
||||
parser.doctype += c;
|
||||
if (c === parser.q) {
|
||||
parser.q = "";
|
||||
parser.state = S.DOCTYPE;
|
||||
}
|
||||
continue;
|
||||
case S.DOCTYPE_DTD:
|
||||
parser.doctype += c;
|
||||
if (c === "]") parser.state = S.DOCTYPE;
|
||||
else if (is(quote,c)) {
|
||||
parser.state = S.DOCTYPE_DTD_QUOTED;
|
||||
parser.q = c;
|
||||
}
|
||||
continue;
|
||||
case S.DOCTYPE_DTD_QUOTED:
|
||||
parser.doctype += c;
|
||||
if (c === parser.q) {
|
||||
parser.state = S.DOCTYPE_DTD;
|
||||
parser.q = "";
|
||||
}
|
||||
continue;
|
||||
case S.COMMENT:
|
||||
if (c === "-") parser.state = S.COMMENT_ENDING;
|
||||
else parser.comment += c;
|
||||
continue;
|
||||
case S.COMMENT_ENDING:
|
||||
if (c === "-") {
|
||||
parser.state = S.COMMENT_ENDED;
|
||||
parser.comment = textopts(parser.opt, parser.comment);
|
||||
if (parser.comment) emitNode(parser, "oncomment", parser.comment);
|
||||
parser.comment = "";
|
||||
} else {
|
||||
strictFail(parser, "Invalid comment");
|
||||
parser.comment += "-" + c;
|
||||
}
|
||||
continue;
|
||||
case S.COMMENT_ENDED:
|
||||
if (c !== ">") strictFail(parser, "Malformed comment");
|
||||
else parser.state = S.TEXT;
|
||||
continue;
|
||||
case S.CDATA:
|
||||
if (c === "]") parser.state = S.CDATA_ENDING;
|
||||
else parser.cdata += c;
|
||||
continue;
|
||||
case S.CDATA_ENDING:
|
||||
if (c === "]") parser.state = S.CDATA_ENDING_2;
|
||||
else {
|
||||
parser.cdata += "]" + c;
|
||||
parser.state = S.CDATA;
|
||||
}
|
||||
continue;
|
||||
case S.CDATA_ENDING_2:
|
||||
if (c === ">") {
|
||||
emitNode(parser, "oncdata", parser.cdata);
|
||||
parser.cdata = "";
|
||||
parser.state = S.TEXT;
|
||||
} else {
|
||||
parser.cdata += "]]" + c;
|
||||
parser.state = S.CDATA;
|
||||
}
|
||||
continue;
|
||||
case S.PROC_INST:
|
||||
if (c === "?") parser.state = S.PROC_INST_ENDING;
|
||||
else if (is(whitespace, c)) parser.state = S.PROC_INST_BODY;
|
||||
else parser.procInstName += c;
|
||||
continue;
|
||||
case S.PROC_INST_BODY:
|
||||
if (!parser.procInstBody && is(whitespace, c)) continue;
|
||||
else if (c === "?") parser.state = S.PROC_INST_ENDING;
|
||||
else if (is(quote, c)) {
|
||||
parser.state = S.PROC_INST_QUOTED;
|
||||
parser.q = c;
|
||||
parser.procInstBody += c;
|
||||
} else parser.procInstBody += c;
|
||||
continue;
|
||||
case S.PROC_INST_ENDING:
|
||||
if (c === ">") {
|
||||
emitNode(parser, "onprocessinginstruction", {
|
||||
name : parser.procInstName,
|
||||
body : parser.procInstBody
|
||||
});
|
||||
parser.procInstName = parser.procInstBody = "";
|
||||
parser.state = S.TEXT;
|
||||
} else {
|
||||
parser.procInstBody += "?" + c;
|
||||
parser.state = S.PROC_INST_BODY;
|
||||
}
|
||||
continue;
|
||||
case S.PROC_INST_QUOTED:
|
||||
parser.procInstBody += c;
|
||||
if (c === parser.q) {
|
||||
parser.state = S.PROC_INST_BODY;
|
||||
parser.q = "";
|
||||
}
|
||||
continue;
|
||||
case S.OPEN_TAG:
|
||||
if (is(nameBody, c)) parser.tagName += c;
|
||||
else {
|
||||
newTag(parser);
|
||||
if (c === ">") openTag(parser);
|
||||
else if (c === "/") parser.state = S.OPEN_TAG_SLASH;
|
||||
else {
|
||||
if (not(whitespace, c)) strictFail(
|
||||
parser, "Invalid character in tag name");
|
||||
parser.state = S.ATTRIB;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case S.OPEN_TAG_SLASH:
|
||||
if (c === ">") {
|
||||
openTag(parser);
|
||||
closeTag(parser);
|
||||
} else {
|
||||
strictFail(parser, "Forward-slash in opening tag not followed by >");
|
||||
parser.state = S.ATTRIB;
|
||||
}
|
||||
continue;
|
||||
case S.ATTRIB:
|
||||
// haven't read the attribute name yet.
|
||||
if (is(whitespace, c)) continue;
|
||||
else if (c === ">") openTag(parser);
|
||||
else if (is(nameStart, c)) {
|
||||
parser.attribName = c;
|
||||
parser.attribValue = "";
|
||||
parser.state = S.ATTRIB_NAME;
|
||||
} else strictFail(parser, "Invalid attribute name");
|
||||
continue;
|
||||
case S.ATTRIB_NAME:
|
||||
if (c === "=") parser.state = S.ATTRIB_VALUE;
|
||||
else if (is(whitespace, c)) parser.state = S.ATTRIB_NAME_SAW_WHITE;
|
||||
else if (is(nameBody, c)) parser.attribName += c;
|
||||
else strictFail(parser, "Invalid attribute name");
|
||||
continue;
|
||||
case S.ATTRIB_NAME_SAW_WHITE:
|
||||
if (c === "=") parser.state = S.ATTRIB_VALUE;
|
||||
else if (is(whitespace, c)) continue;
|
||||
else {
|
||||
strictFail(parser, "Attribute without value");
|
||||
parser.tag.attributes[parser.attribName] = "";
|
||||
parser.attribValue = "";
|
||||
emitNode(parser, "onattribute", { name : parser.attribName, value : "" });
|
||||
parser.attribName = "";
|
||||
if (c === ">") openTag(parser);
|
||||
else if (is(nameStart, c)) {
|
||||
parser.attribName = c;
|
||||
parser.state = S.ATTRIB_NAME;
|
||||
} else {
|
||||
strictFail(parser, "Invalid attribute name");
|
||||
parser.state = S.ATTRIB;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case S.ATTRIB_VALUE:
|
||||
if (is(quote, c)) {
|
||||
parser.q = c;
|
||||
parser.state = S.ATTRIB_VALUE_QUOTED;
|
||||
} else {
|
||||
strictFail(parser, "Unquoted attribute value");
|
||||
parser.state = S.ATTRIB_VALUE_UNQUOTED;
|
||||
parser.attribValue = c;
|
||||
}
|
||||
continue;
|
||||
case S.ATTRIB_VALUE_QUOTED:
|
||||
if (c !== parser.q) {
|
||||
if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_Q;
|
||||
else parser.attribValue += c;
|
||||
continue;
|
||||
}
|
||||
parser.tag.attributes[parser.attribName] = parser.attribValue;
|
||||
emitNode(parser, "onattribute", {
|
||||
name:parser.attribName, value:parser.attribValue});
|
||||
parser.attribName = parser.attribValue = "";
|
||||
parser.q = "";
|
||||
parser.state = S.ATTRIB;
|
||||
continue;
|
||||
case S.ATTRIB_VALUE_UNQUOTED:
|
||||
if (not(whitespace+">",c)) {
|
||||
if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_U;
|
||||
else parser.attribValue += c;
|
||||
continue;
|
||||
}
|
||||
emitNode(parser, "onattribute", {
|
||||
name:parser.attribName, value:parser.attribValue});
|
||||
parser.attribName = parser.attribValue = "";
|
||||
if (c === ">") openTag(parser);
|
||||
else parser.state = S.ATTRIB;
|
||||
continue;
|
||||
case S.CLOSE_TAG:
|
||||
if (!parser.tagName) {
|
||||
if (is(whitespace, c)) continue;
|
||||
else if (not(nameStart, c)) strictFail(parser,
|
||||
"Invalid tagname in closing tag.");
|
||||
else parser.tagName = c;
|
||||
}
|
||||
else if (c === ">") closeTag(parser);
|
||||
else if (is(nameBody, c)) parser.tagName += c;
|
||||
else {
|
||||
if (not(whitespace, c)) strictFail(parser,
|
||||
"Invalid tagname in closing tag");
|
||||
parser.state = S.CLOSE_TAG_SAW_WHITE;
|
||||
}
|
||||
continue;
|
||||
case S.CLOSE_TAG_SAW_WHITE:
|
||||
if (is(whitespace, c)) continue;
|
||||
if (c === ">") closeTag(parser);
|
||||
else strictFail("Invalid characters in closing tag");
|
||||
continue;
|
||||
case S.TEXT_ENTITY:
|
||||
case S.ATTRIB_VALUE_ENTITY_Q:
|
||||
case S.ATTRIB_VALUE_ENTITY_U:
|
||||
switch(parser.state) {
|
||||
case S.TEXT_ENTITY:
|
||||
var returnState = S.TEXT, buffer = "textNode";
|
||||
break;
|
||||
case S.ATTRIB_VALUE_ENTITY_Q:
|
||||
var returnState = S.ATTRIB_VALUE_QUOTED, buffer = "attribValue";
|
||||
break;
|
||||
case S.ATTRIB_VALUE_ENTITY_U:
|
||||
var returnState = S.ATTRIB_VALUE_UNQUOTED, buffer = "attribValue";
|
||||
break;
|
||||
}
|
||||
if (c === ";") {
|
||||
parser[buffer] += parseEntity(parser);
|
||||
parser.entity = "";
|
||||
parser.state = returnState;
|
||||
}
|
||||
else if (is(entity, c)) parser.entity += c;
|
||||
else {
|
||||
strictFail("Invalid character entity");
|
||||
parser[buffer] += "&" + parser.entity;
|
||||
parser.entity = "";
|
||||
parser.state = returnState;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
throw "Unknown state: " + parser.state;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parser;
|
||||
}
|
||||
|
166
bower_components/jsdom/example/sizzle/run.js
vendored
166
bower_components/jsdom/example/sizzle/run.js
vendored
@ -1,166 +0,0 @@
|
||||
var browser = require("../../lib/jsdom/browser");
|
||||
var dom = browser.browserAugmentation(require("../../lib/jsdom/level2/core").dom.level2.core);
|
||||
|
||||
var util = require("util");
|
||||
|
||||
|
||||
var doc = new dom.Document("html");
|
||||
|
||||
var implementation = new dom.DOMImplementation(doc, {
|
||||
"HTML" : "1.0",
|
||||
"DisableLiveLists" : "1.0"
|
||||
});
|
||||
|
||||
var notations = new dom.NotationNodeMap(
|
||||
doc,
|
||||
doc.createNotationNode("notation1","notation1File", null),
|
||||
doc.createNotationNode("notation2",null, "notation2File")
|
||||
);
|
||||
|
||||
// TODO: consider importing the master list of entities
|
||||
// http://www.w3schools.com/tags/ref_symbols.asp
|
||||
var entities = new dom.EntityNodeMap(
|
||||
doc,
|
||||
doc.createEntityNode("alpha", "α"),
|
||||
doc.createEntityNode("beta", "β"),
|
||||
doc.createEntityNode("gamma", "γ"),
|
||||
doc.createEntityNode("delta", "δ"),
|
||||
doc.createEntityNode("epsilon", "ε")
|
||||
);
|
||||
|
||||
// <!ATTLIST acronym dir CDATA "ltr">
|
||||
|
||||
var defaultAttributes = new dom.NamedNodeMap(doc);
|
||||
var acronym = doc.createElement("acronym");
|
||||
acronym.setAttribute("dir", "ltr");
|
||||
defaultAttributes.setNamedItem(acronym);
|
||||
|
||||
|
||||
|
||||
var doctype = new dom.DocumentType(doc, "html", entities, notations, defaultAttributes);
|
||||
doc.doctype = doctype;
|
||||
doc.implementation = implementation;
|
||||
|
||||
doc.appendChild(doc.createComment(" This is comment number 1."));
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var html = doc.appendChild(html);
|
||||
var head = doc.createElement("head");
|
||||
var head = html.appendChild(head);
|
||||
|
||||
var meta = doc.createElement("meta");
|
||||
meta.setAttribute("http-equiv", "Content-Type");
|
||||
meta.setAttribute("content", "text/html; charset=UTF-8");
|
||||
head.appendChild(meta);
|
||||
|
||||
var title = doc.createElement("title")
|
||||
title.appendChild(doc.createTextNode("hc_staff"));
|
||||
var title = head.appendChild(title);
|
||||
|
||||
// make the tests work....
|
||||
head.appendChild(doc.createElement("script"));
|
||||
head.appendChild(doc.createElement("script"));
|
||||
head.appendChild(doc.createElement("script"));
|
||||
|
||||
var body = doc.createElement("body");
|
||||
var staff = html.appendChild(body);
|
||||
|
||||
var employees = [];
|
||||
var addresses = [];
|
||||
var names = [];
|
||||
var positions = [];
|
||||
var genders = [];
|
||||
var ids = [];
|
||||
var salaries = [];
|
||||
|
||||
// create 5 employees
|
||||
for (var i=0; i<5; i++)
|
||||
{
|
||||
var employee = doc.createElement("p");
|
||||
var address = doc.createElement("acronym");
|
||||
var name = doc.createElement("strong");
|
||||
var position = doc.createElement("code");
|
||||
var gender = doc.createElement("var");
|
||||
var id = doc.createElement("em");
|
||||
var salary = doc.createElement("sup");
|
||||
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
employee.appendChild(id);
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
employee.appendChild(name);
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
employee.appendChild(position);
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
employee.appendChild(salary);
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
employee.appendChild(gender);
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
employee.appendChild(address);
|
||||
employee.appendChild(doc.createTextNode("\n"));
|
||||
staff.appendChild(employee);
|
||||
|
||||
names.push(name);
|
||||
employees.push(employee);
|
||||
addresses.push(address);
|
||||
genders.push(gender);
|
||||
positions.push(position);
|
||||
ids.push(id);
|
||||
salaries.push(salary);
|
||||
}
|
||||
|
||||
ids[0].appendChild(doc.createTextNode("EMP0001"));
|
||||
salaries[0].appendChild(doc.createTextNode("56,000"));
|
||||
addresses[0].setAttribute("title", "Yes");
|
||||
addresses[0].appendChild(doc.createTextNode('1230 North Ave. Dallas, Texas 98551'));
|
||||
names[0].appendChild(doc.createTextNode("Margaret Martin"));
|
||||
genders[0].appendChild(doc.createTextNode("Female"));
|
||||
positions[0].appendChild(doc.createTextNode("Accountant"));
|
||||
|
||||
ids[1].appendChild(doc.createTextNode("EMP0002"));
|
||||
salaries[1].appendChild(doc.createTextNode("35,000"));
|
||||
addresses[1].setAttribute("title", "Yes");
|
||||
addresses[1].setAttribute("class", "Yes");
|
||||
addresses[1].appendChild(doc.createTextNode("β Dallas, γ\n 98554"));
|
||||
names[1].appendChild(doc.createTextNode("Martha Raynolds"));
|
||||
//names[1].appendChild(doc.createCDATASection("This is a CDATASection with EntityReference number 2 &ent2;"));
|
||||
//names[1].appendChild(doc.createCDATASection("This is an adjacent CDATASection with a reference to a tab &tab;"));
|
||||
genders[1].appendChild(doc.createTextNode("Female"));
|
||||
positions[1].appendChild(doc.createTextNode("Secretary"));
|
||||
|
||||
ids[2].appendChild(doc.createTextNode("EMP0003"));
|
||||
salaries[2].appendChild(doc.createTextNode("100,000"));
|
||||
addresses[2].setAttribute("title", "Yes");
|
||||
addresses[2].setAttribute("class", "No");
|
||||
addresses[2].appendChild(doc.createTextNode("PO Box 27 Irving, texas 98553"));
|
||||
names[2].appendChild(doc.createTextNode("Roger\n Jones")) ;
|
||||
// genders[2].appendChild(doc.createEntityReference("δ"));//Text("δ"));
|
||||
positions[2].appendChild(doc.createTextNode("Department Manager"));
|
||||
|
||||
ids[3].appendChild(doc.createTextNode("EMP0004"));
|
||||
ids[3].className = "classy";
|
||||
salaries[3].appendChild(doc.createTextNode("95,000"));
|
||||
addresses[3].setAttribute("title", "Yes");
|
||||
addresses[3].setAttribute("class", "Yα");
|
||||
addresses[3].appendChild(doc.createTextNode("27 South Road. Dallas, Texas 98556"));
|
||||
names[3].appendChild(doc.createTextNode("Jeny Oconnor"));
|
||||
genders[3].appendChild(doc.createTextNode("Female"));
|
||||
positions[3].appendChild(doc.createTextNode("Personal Director"));
|
||||
|
||||
ids[4].appendChild(doc.createTextNode("EMP0005"));
|
||||
salaries[4].appendChild(doc.createTextNode("90,000"));
|
||||
addresses[4].setAttribute("title", "No");
|
||||
addresses[4].id = "theid";
|
||||
addresses[4].appendChild(doc.createTextNode("1821 Nordic. Road, Irving Texas 98558"));
|
||||
names[4].appendChild(doc.createTextNode("Robert Myers"));
|
||||
genders[4].appendChild(doc.createTextNode("male"));
|
||||
positions[4].appendChild(doc.createTextNode("Computer Specialist"));
|
||||
|
||||
//doc.appendChild(doc.createProcessingInstruction("TEST-STYLE", "PIDATA"));
|
||||
|
||||
doc.normalize();
|
||||
|
||||
var sizzleSandbox = {};
|
||||
var sizzle = require("./sizzle").sizzleInit(sizzleSandbox, doc);
|
||||
console.log(util.inspect(sizzle('.classy,p acronym#theid').length));
|
||||
|
||||
|
534
bower_components/jsdom/example/sizzle/sax.js
vendored
534
bower_components/jsdom/example/sizzle/sax.js
vendored
@ -1,534 +0,0 @@
|
||||
var sax = exports;
|
||||
sax.parser = function (strict, opt) { return new SAXParser(strict, opt) };
|
||||
sax.SAXParser = SAXParser;
|
||||
|
||||
function SAXParser (strict, opt) {
|
||||
this.c = this.comment = this.sgmlDecl =
|
||||
this.textNode = this.tagName = this.doctype =
|
||||
this.procInstName = this.procInstBody = this.entity =
|
||||
this.attribName = this.attribValue = this.q =
|
||||
this.cdata = this.sgmlDecl = "";
|
||||
this.opt = opt || {};
|
||||
this.tagCase = this.opt.lowercasetags ? "toLowerCase" : "toUpperCase";
|
||||
this.tags = [];
|
||||
this.closed = this.closedRoot = this.sawRoot = false;
|
||||
this.tag = this.error = null;
|
||||
this.strict = !!strict;
|
||||
this.state = S.BEGIN;
|
||||
this.ENTITIES = Object.create(sax.ENTITIES);
|
||||
|
||||
// just for error reporting
|
||||
this.position = this.line = this.column = 0;
|
||||
emit(this, "onready");
|
||||
}
|
||||
SAXParser.prototype = {
|
||||
write : write,
|
||||
resume : function () { this.error = null; return this },
|
||||
close : function () { return this.write(null) },
|
||||
}
|
||||
|
||||
// character classes and tokens
|
||||
var whitespace = "\n\t ",
|
||||
// this really needs to be replaced with character classes.
|
||||
// XML allows all manner of ridiculous numbers and digits.
|
||||
number = "0124356789",
|
||||
letter = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
// (Letter | '_' | ':')
|
||||
nameStart = letter+"_:",
|
||||
nameBody = nameStart+number+"-.",
|
||||
quote = "'\"",
|
||||
entity = number+letter+"#",
|
||||
CDATA = "[CDATA[",
|
||||
DOCTYPE = "DOCTYPE";
|
||||
function is (charclass, c) { return charclass.indexOf(c) !== -1 }
|
||||
function not (charclass, c) { return !is(charclass, c) }
|
||||
|
||||
var S = 0;
|
||||
sax.STATE =
|
||||
{ BEGIN : S++
|
||||
, TEXT : S++ // general stuff
|
||||
, TEXT_ENTITY : S++ // & and such.
|
||||
, OPEN_WAKA : S++ // <
|
||||
, SGML_DECL : S++ // <!BLARG
|
||||
, SGML_DECL_QUOTED : S++ // <!BLARG foo "bar
|
||||
, DOCTYPE : S++ // <!DOCTYPE
|
||||
, DOCTYPE_QUOTED : S++ // <!DOCTYPE "//blah
|
||||
, DOCTYPE_DTD : S++ // <!DOCTYPE "//blah" [ ...
|
||||
, DOCTYPE_DTD_QUOTED : S++ // <!DOCTYPE "//blah" [ "foo
|
||||
, COMMENT_STARTING : S++ // <!-
|
||||
, COMMENT : S++ // <!--
|
||||
, COMMENT_ENDING : S++ // <!-- blah -
|
||||
, COMMENT_ENDED : S++ // <!-- blah --
|
||||
, CDATA : S++ // <![CDATA[ something
|
||||
, CDATA_ENDING : S++ // ]
|
||||
, CDATA_ENDING_2 : S++ // ]]
|
||||
, PROC_INST : S++ // <?hi
|
||||
, PROC_INST_BODY : S++ // <?hi there
|
||||
, PROC_INST_QUOTED : S++ // <?hi there
|
||||
, PROC_INST_ENDING : S++ // <?hi there ?
|
||||
, OPEN_TAG : S++ // <strong
|
||||
, OPEN_TAG_SLASH : S++ // <strong /
|
||||
, ATTRIB : S++ // <a
|
||||
, ATTRIB_NAME : S++ // <a foo
|
||||
, ATTRIB_NAME_SAW_WHITE : S++ // <a foo _
|
||||
, ATTRIB_VALUE : S++ // <a foo="bar
|
||||
, ATTRIB_VALUE_QUOTED : S++ // <a foo="bar
|
||||
, ATTRIB_VALUE_UNQUOTED : S++ // <a foo="bar
|
||||
, ATTRIB_VALUE_ENTITY_Q : S++ // <foo bar="""
|
||||
, ATTRIB_VALUE_ENTITY_U : S++ // <foo bar="
|
||||
, CLOSE_TAG : S++ // </a
|
||||
, CLOSE_TAG_SAW_WHITE : S++ // </a >
|
||||
}
|
||||
|
||||
sax.ENTITIES =
|
||||
{ "apos" : "'"
|
||||
, "quot" : '"'
|
||||
, "amp" : "&"
|
||||
, "gt" : ">"
|
||||
, "lt" : "<"
|
||||
}
|
||||
|
||||
for (var S in sax.STATE) sax.STATE[sax.STATE[S]] = S;
|
||||
|
||||
// shorthand
|
||||
S = sax.STATE;
|
||||
sax.EVENTS = [ // for discoverability.
|
||||
"text", "processinginstruction", "sgmldeclaration",
|
||||
"doctype", "comment", "attribute", "opentag", "closetag",
|
||||
"cdata", "error", "end", "ready" ];
|
||||
|
||||
function emit (parser, event, data) {
|
||||
parser[event] && parser[event](data);
|
||||
}
|
||||
function emitNode (parser, nodeType, data) {
|
||||
if (parser.textNode) closeText(parser);
|
||||
emit(parser, nodeType, data);
|
||||
}
|
||||
function closeText (parser) {
|
||||
parser.textNode = textopts(parser.opt, parser.textNode);
|
||||
if (parser.textNode) emit(parser, "ontext", parser.textNode);
|
||||
parser.textNode = "";
|
||||
}
|
||||
function textopts (opt, text) {
|
||||
if (opt.trim) text = text.trim();
|
||||
if (opt.normalize) text = text.replace(/\s+/g, " ");
|
||||
return text;
|
||||
}
|
||||
function error (parser, er) {
|
||||
closeText(parser);
|
||||
er += "\nLine: "+parser.line+
|
||||
"\nColumn: "+parser.column+
|
||||
"\nChar: "+parser.c;
|
||||
er = new Error(er);
|
||||
parser.error = er;
|
||||
emit(parser, "onerror", er);
|
||||
return parser;
|
||||
}
|
||||
function end (parser) {
|
||||
if (parser.state !== S.TEXT) error(parser, "Unexpected end");
|
||||
closeText(parser);
|
||||
parser.c = "";
|
||||
parser.closed = true;
|
||||
emit(parser, "onend");
|
||||
SAXParser.call(parser, parser.strict, parser.opt);
|
||||
return parser;
|
||||
}
|
||||
function strictFail (parser, message) {
|
||||
if (parser.strict) error(parser, message);
|
||||
}
|
||||
function newTag (parser) {
|
||||
if (!parser.strict) parser.tagName = parser.tagName[parser.tagCase]();
|
||||
parser.tag = { name : parser.tagName, attributes : {} };
|
||||
}
|
||||
function openTag (parser) {
|
||||
parser.sawRoot = true;
|
||||
parser.tags.push(parser.tag);
|
||||
emitNode(parser, "onopentag", parser.tag);
|
||||
parser.tag = null;
|
||||
parser.tagName = parser.attribName = parser.attribValue = "";
|
||||
parser.state = S.TEXT;
|
||||
}
|
||||
function closeTag (parser) {
|
||||
if (!parser.tagName) {
|
||||
strictFail(parser, "Weird empty close tag.");
|
||||
parser.textNode += "</>";
|
||||
parser.state = S.TEXT;
|
||||
return;
|
||||
}
|
||||
do {
|
||||
if (!parser.strict) parser.tagName = parser.tagName[parser.tagCase]();
|
||||
var closeTo = parser.tagName, close = parser.tags.pop();
|
||||
if (!close) {
|
||||
throw "wtf "+parser.tagName+" "+parser.tags+" "+parser.line+ " "+parser.position;
|
||||
}
|
||||
if (closeTo !== close.name) strictFail(parser, "Unexpected close tag.");
|
||||
parser.tag = close;
|
||||
parser.tagName = close.name;
|
||||
emitNode(parser, "onclosetag", parser.tagName);
|
||||
} while (closeTo !== close.name);
|
||||
if (parser.tags.length === 0) parser.closedRoot = true;
|
||||
parser.tagName = parser.attribValue = parser.attribName = "";
|
||||
parser.tag = null;
|
||||
parser.state = S.TEXT;
|
||||
}
|
||||
function parseEntity (parser) {
|
||||
var entity = parser.entity.toLowerCase(), num, numStr = "";
|
||||
if (parser.ENTITIES[entity]) return parser.ENTITIES[entity];
|
||||
if (entity.charAt(0) === "#") {
|
||||
if (entity.charAt(1) === "x") {
|
||||
entity = entity.slice(2);
|
||||
num = parseInt(entity, 16), numStr = num.toString(16);
|
||||
} else {
|
||||
entity = entity.slice(1);
|
||||
num = parseInt(entity, 10), numStr = num.toString(10);
|
||||
}
|
||||
}
|
||||
if (numStr.toLowerCase() !== entity) {
|
||||
strictFail(parser, "Invalid character entity");
|
||||
return "&"+parser.entity + ";";
|
||||
}
|
||||
return String.fromCharCode(num);
|
||||
}
|
||||
|
||||
function write (chunk) {
|
||||
var parser = this;
|
||||
if (this.error) throw this.error;
|
||||
if (parser.closed) return error(parser,
|
||||
"Cannot write after close. Assign an onready handler.");
|
||||
if (chunk === null) return end(parser);
|
||||
var i = 0, c = ""
|
||||
while (parser.c = c = chunk.charAt(i++)) {
|
||||
parser.position ++;
|
||||
if (c === "\n") {
|
||||
parser.line ++;
|
||||
parser.column = 0;
|
||||
} else parser.column ++;
|
||||
switch (parser.state) {
|
||||
case S.BEGIN:
|
||||
if (c === "<") parser.state = S.OPEN_WAKA;
|
||||
else if (not(whitespace,c)) {
|
||||
// have to process this as a text node.
|
||||
// weird, but happens.
|
||||
strictFail(parser, "Non-whitespace before first tag.");
|
||||
parser.textNode = c;
|
||||
state = S.TEXT;
|
||||
}
|
||||
continue;
|
||||
case S.TEXT:
|
||||
if (c === "<") parser.state = S.OPEN_WAKA;
|
||||
else if (not(whitespace, c) && (!parser.sawRoot || parser.closedRoot)) {
|
||||
strictFail("Text data outside of root node.");
|
||||
}
|
||||
else if (c === "&") parser.state = S.TEXT_ENTITY;
|
||||
else parser.textNode += c;
|
||||
continue;
|
||||
case S.OPEN_WAKA:
|
||||
// either a /, ?, !, or text is coming next.
|
||||
if (c === "!") {
|
||||
parser.state = S.SGML_DECL;
|
||||
parser.sgmlDecl = "";
|
||||
} else if (is(whitespace, c)) {
|
||||
// wait for it...
|
||||
} else if (is(nameStart,c)) {
|
||||
parser.state = S.OPEN_TAG;
|
||||
parser.tagName = c;
|
||||
} else if (c === "/") {
|
||||
parser.state = S.CLOSE_TAG;
|
||||
parser.tagName = "";
|
||||
} else if (c === "?") {
|
||||
parser.state = S.PROC_INST;
|
||||
parser.procInstName = parser.procInstBody = "";
|
||||
} else {
|
||||
strictFail(parser, "Unencoded <");
|
||||
parser.textNode += "<" + c;
|
||||
parser.state = S.TEXT;
|
||||
}
|
||||
continue;
|
||||
case S.SGML_DECL:
|
||||
if ((parser.sgmlDecl+c).toUpperCase() === CDATA) {
|
||||
parser.state = S.CDATA;
|
||||
parser.sgmlDecl = "";
|
||||
parser.cdata = "";
|
||||
} else if (parser.sgmlDecl+c === "--") {
|
||||
parser.state = S.COMMENT;
|
||||
parser.comment = "";
|
||||
parser.sgmlDecl = "";
|
||||
} else if ((parser.sgmlDecl+c).toUpperCase() === DOCTYPE) {
|
||||
parser.state = S.DOCTYPE;
|
||||
if (parser.doctype || parser.sawRoot) strictFail(parser,
|
||||
"Inappropriately located doctype declaration");
|
||||
parser.doctype = "";
|
||||
parser.sgmlDecl = "";
|
||||
} else if (c === ">") {
|
||||
emitNode(parser, "onsgmldeclaration", parser.sgmlDecl);
|
||||
parser.sgmlDecl = "";
|
||||
parser.state = S.TEXT;
|
||||
} else if (is(quote, c)) {
|
||||
parser.state = S.SGML_DECL_QUOTED;
|
||||
parser.sgmlDecl += c;
|
||||
} else parser.sgmlDecl += c;
|
||||
continue;
|
||||
case S.SGML_DECL_QUOTED:
|
||||
if (c === parser.q) {
|
||||
parser.state = S.SGML_DECL;
|
||||
parser.q = "";
|
||||
}
|
||||
parser.sgmlDecl += c;
|
||||
continue;
|
||||
case S.DOCTYPE:
|
||||
if (c === ">") {
|
||||
parser.state = S.TEXT;
|
||||
emitNode(parser, "ondoctype", parser.doctype);
|
||||
parser.doctype = true; // just remember that we saw it.
|
||||
} else {
|
||||
parser.doctype += c;
|
||||
if (c === "[") parser.state = S.DOCTYPE_DTD;
|
||||
else if (is(quote, c)) {
|
||||
parser.state = S.DOCTYPE_QUOTED;
|
||||
parser.q = c;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case S.DOCTYPE_QUOTED:
|
||||
parser.doctype += c;
|
||||
if (c === parser.q) {
|
||||
parser.q = "";
|
||||
parser.state = S.DOCTYPE;
|
||||
}
|
||||
continue;
|
||||
case S.DOCTYPE_DTD:
|
||||
parser.doctype += c;
|
||||
if (c === "]") parser.state = S.DOCTYPE;
|
||||
else if (is(quote,c)) {
|
||||
parser.state = S.DOCTYPE_DTD_QUOTED;
|
||||
parser.q = c;
|
||||
}
|
||||
continue;
|
||||
case S.DOCTYPE_DTD_QUOTED:
|
||||
parser.doctype += c;
|
||||
if (c === parser.q) {
|
||||
parser.state = S.DOCTYPE_DTD;
|
||||
parser.q = "";
|
||||
}
|
||||
continue;
|
||||
case S.COMMENT:
|
||||
if (c === "-") parser.state = S.COMMENT_ENDING;
|
||||
else parser.comment += c;
|
||||
continue;
|
||||
case S.COMMENT_ENDING:
|
||||
if (c === "-") {
|
||||
parser.state = S.COMMENT_ENDED;
|
||||
parser.comment = textopts(parser.opt, parser.comment);
|
||||
if (parser.comment) emitNode(parser, "oncomment", parser.comment);
|
||||
parser.comment = "";
|
||||
} else {
|
||||
strictFail(parser, "Invalid comment");
|
||||
parser.comment += "-" + c;
|
||||
}
|
||||
continue;
|
||||
case S.COMMENT_ENDED:
|
||||
if (c !== ">") strictFail(parser, "Malformed comment");
|
||||
else parser.state = S.TEXT;
|
||||
continue;
|
||||
case S.CDATA:
|
||||
if (c === "]") parser.state = S.CDATA_ENDING;
|
||||
else parser.cdata += c;
|
||||
continue;
|
||||
case S.CDATA_ENDING:
|
||||
if (c === "]") parser.state = S.CDATA_ENDING_2;
|
||||
else {
|
||||
parser.cdata += "]" + c;
|
||||
parser.state = S.CDATA;
|
||||
}
|
||||
continue;
|
||||
case S.CDATA_ENDING_2:
|
||||
if (c === ">") {
|
||||
emitNode(parser, "oncdata", parser.cdata);
|
||||
parser.cdata = "";
|
||||
parser.state = S.TEXT;
|
||||
} else {
|
||||
parser.cdata += "]]" + c;
|
||||
parser.state = S.CDATA;
|
||||
}
|
||||
continue;
|
||||
case S.PROC_INST:
|
||||
if (c === "?") parser.state = S.PROC_INST_ENDING;
|
||||
else if (is(whitespace, c)) parser.state = S.PROC_INST_BODY;
|
||||
else parser.procInstName += c;
|
||||
continue;
|
||||
case S.PROC_INST_BODY:
|
||||
if (!parser.procInstBody && is(whitespace, c)) continue;
|
||||
else if (c === "?") parser.state = S.PROC_INST_ENDING;
|
||||
else if (is(quote, c)) {
|
||||
parser.state = S.PROC_INST_QUOTED;
|
||||
parser.q = c;
|
||||
parser.procInstBody += c;
|
||||
} else parser.procInstBody += c;
|
||||
continue;
|
||||
case S.PROC_INST_ENDING:
|
||||
if (c === ">") {
|
||||
emitNode(parser, "onprocessinginstruction", {
|
||||
name : parser.procInstName,
|
||||
body : parser.procInstBody
|
||||
});
|
||||
parser.procInstName = parser.procInstBody = "";
|
||||
parser.state = S.TEXT;
|
||||
} else {
|
||||
parser.procInstBody += "?" + c;
|
||||
parser.state = S.PROC_INST_BODY;
|
||||
}
|
||||
continue;
|
||||
case S.PROC_INST_QUOTED:
|
||||
parser.procInstBody += c;
|
||||
if (c === parser.q) {
|
||||
parser.state = S.PROC_INST_BODY;
|
||||
parser.q = "";
|
||||
}
|
||||
continue;
|
||||
case S.OPEN_TAG:
|
||||
if (is(nameBody, c)) parser.tagName += c;
|
||||
else {
|
||||
newTag(parser);
|
||||
if (c === ">") openTag(parser);
|
||||
else if (c === "/") parser.state = S.OPEN_TAG_SLASH;
|
||||
else {
|
||||
if (not(whitespace, c)) strictFail(
|
||||
parser, "Invalid character in tag name");
|
||||
parser.state = S.ATTRIB;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case S.OPEN_TAG_SLASH:
|
||||
if (c === ">") {
|
||||
openTag(parser);
|
||||
closeTag(parser);
|
||||
} else {
|
||||
strictFail(parser, "Forward-slash in opening tag not followed by >");
|
||||
parser.state = S.ATTRIB;
|
||||
}
|
||||
continue;
|
||||
case S.ATTRIB:
|
||||
// haven't read the attribute name yet.
|
||||
if (is(whitespace, c)) continue;
|
||||
else if (c === ">") openTag(parser);
|
||||
else if (is(nameStart, c)) {
|
||||
parser.attribName = c;
|
||||
parser.attribValue = "";
|
||||
parser.state = S.ATTRIB_NAME;
|
||||
} else strictFail(parser, "Invalid attribute name");
|
||||
continue;
|
||||
case S.ATTRIB_NAME:
|
||||
if (c === "=") parser.state = S.ATTRIB_VALUE;
|
||||
else if (is(whitespace, c)) parser.state = S.ATTRIB_NAME_SAW_WHITE;
|
||||
else if (is(nameBody, c)) parser.attribName += c;
|
||||
else strictFail(parser, "Invalid attribute name");
|
||||
continue;
|
||||
case S.ATTRIB_NAME_SAW_WHITE:
|
||||
if (c === "=") parser.state = S.ATTRIB_VALUE;
|
||||
else if (is(whitespace, c)) continue;
|
||||
else {
|
||||
strictFail(parser, "Attribute without value");
|
||||
parser.tag.attributes[parser.attribName] = "";
|
||||
parser.attribValue = "";
|
||||
emitNode(parser, "onattribute", { name : parser.attribName, value : "" });
|
||||
parser.attribName = "";
|
||||
if (c === ">") openTag(parser);
|
||||
else if (is(nameStart, c)) {
|
||||
parser.attribName = c;
|
||||
parser.state = S.ATTRIB_NAME;
|
||||
} else {
|
||||
strictFail(parser, "Invalid attribute name");
|
||||
parser.state = S.ATTRIB;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
case S.ATTRIB_VALUE:
|
||||
if (is(quote, c)) {
|
||||
parser.q = c;
|
||||
parser.state = S.ATTRIB_VALUE_QUOTED;
|
||||
} else {
|
||||
strictFail(parser, "Unquoted attribute value");
|
||||
parser.state = S.ATTRIB_VALUE_UNQUOTED;
|
||||
parser.attribValue = c;
|
||||
}
|
||||
continue;
|
||||
case S.ATTRIB_VALUE_QUOTED:
|
||||
if (c !== parser.q) {
|
||||
if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_Q;
|
||||
else parser.attribValue += c;
|
||||
continue;
|
||||
}
|
||||
parser.tag.attributes[parser.attribName] = parser.attribValue;
|
||||
emitNode(parser, "onattribute", {
|
||||
name:parser.attribName, value:parser.attribValue});
|
||||
parser.attribName = parser.attribValue = "";
|
||||
parser.q = "";
|
||||
parser.state = S.ATTRIB;
|
||||
continue;
|
||||
case S.ATTRIB_VALUE_UNQUOTED:
|
||||
if (not(whitespace+">",c)) {
|
||||
if (c === "&") parser.state = S.ATTRIB_VALUE_ENTITY_U;
|
||||
else parser.attribValue += c;
|
||||
continue;
|
||||
}
|
||||
emitNode(parser, "onattribute", {
|
||||
name:parser.attribName, value:parser.attribValue});
|
||||
parser.attribName = parser.attribValue = "";
|
||||
if (c === ">") openTag(parser);
|
||||
else parser.state = S.ATTRIB;
|
||||
continue;
|
||||
case S.CLOSE_TAG:
|
||||
if (!parser.tagName) {
|
||||
if (is(whitespace, c)) continue;
|
||||
else if (not(nameStart, c)) strictFail(parser,
|
||||
"Invalid tagname in closing tag.");
|
||||
else parser.tagName = c;
|
||||
}
|
||||
else if (c === ">") closeTag(parser);
|
||||
else if (is(nameBody, c)) parser.tagName += c;
|
||||
else {
|
||||
if (not(whitespace, c)) strictFail(parser,
|
||||
"Invalid tagname in closing tag");
|
||||
parser.state = S.CLOSE_TAG_SAW_WHITE;
|
||||
}
|
||||
continue;
|
||||
case S.CLOSE_TAG_SAW_WHITE:
|
||||
if (is(whitespace, c)) continue;
|
||||
if (c === ">") closeTag(parser);
|
||||
else strictFail("Invalid characters in closing tag");
|
||||
continue;
|
||||
case S.TEXT_ENTITY:
|
||||
case S.ATTRIB_VALUE_ENTITY_Q:
|
||||
case S.ATTRIB_VALUE_ENTITY_U:
|
||||
switch(parser.state) {
|
||||
case S.TEXT_ENTITY:
|
||||
var returnState = S.TEXT, buffer = "textNode";
|
||||
break;
|
||||
case S.ATTRIB_VALUE_ENTITY_Q:
|
||||
var returnState = S.ATTRIB_VALUE_QUOTED, buffer = "attribValue";
|
||||
break;
|
||||
case S.ATTRIB_VALUE_ENTITY_U:
|
||||
var returnState = S.ATTRIB_VALUE_UNQUOTED, buffer = "attribValue";
|
||||
break;
|
||||
}
|
||||
if (c === ";") {
|
||||
parser[buffer] += parseEntity(parser);
|
||||
parser.entity = "";
|
||||
parser.state = returnState;
|
||||
}
|
||||
else if (is(entity, c)) parser.entity += c;
|
||||
else {
|
||||
strictFail("Invalid character entity");
|
||||
parser[buffer] += "&" + parser.entity;
|
||||
parser.entity = "";
|
||||
parser.state = returnState;
|
||||
}
|
||||
continue;
|
||||
default:
|
||||
throw "Unknown state: " + parser.state;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return parser;
|
||||
}
|
||||
|
1066
bower_components/jsdom/example/sizzle/sizzle.js
vendored
1066
bower_components/jsdom/example/sizzle/sizzle.js
vendored
File diff suppressed because it is too large
Load Diff
373
bower_components/jsdom/lib/jsdom.js
vendored
373
bower_components/jsdom/lib/jsdom.js
vendored
@ -1,373 +0,0 @@
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var URL = require('url');
|
||||
var pkg = require('../package.json');
|
||||
|
||||
var toFileUrl = require('./jsdom/utils').toFileUrl;
|
||||
var defineGetter = require('./jsdom/utils').defineGetter;
|
||||
var defineSetter = require('./jsdom/utils').defineSetter;
|
||||
var style = require('./jsdom/level2/style');
|
||||
var features = require('./jsdom/browser/documentfeatures');
|
||||
var dom = exports.dom = require('./jsdom/level3/index').dom;
|
||||
var createWindow = exports.createWindow = require('./jsdom/browser/index').createWindow;
|
||||
|
||||
|
||||
var request = function(options, cb) {
|
||||
request = require('request');
|
||||
return request(options, cb);
|
||||
}
|
||||
|
||||
exports.defaultLevel = dom.level3.html;
|
||||
exports.browserAugmentation = require('./jsdom/browser/index').browserAugmentation;
|
||||
exports.windowAugmentation = require('./jsdom/browser/index').windowAugmentation;
|
||||
|
||||
// Proxy feature functions to features module.
|
||||
['availableDocumentFeatures',
|
||||
'defaultDocumentFeatures',
|
||||
'applyDocumentFeatures'].forEach(function (propName) {
|
||||
defineGetter(exports, propName, function () {
|
||||
return features[propName];
|
||||
});
|
||||
defineSetter(exports, propName, function (val) {
|
||||
return features[propName] = val;
|
||||
});
|
||||
});
|
||||
|
||||
exports.debugMode = false;
|
||||
|
||||
defineGetter(exports, 'version', function() {
|
||||
return pkg.version;
|
||||
});
|
||||
|
||||
exports.level = function (level, feature) {
|
||||
if(!feature) {
|
||||
feature = 'core';
|
||||
}
|
||||
|
||||
return require('./jsdom/level' + level + '/' + feature).dom['level' + level][feature];
|
||||
};
|
||||
|
||||
exports.jsdom = function (html, level, options) {
|
||||
|
||||
options = options || {};
|
||||
if(typeof level == 'string') {
|
||||
level = exports.level(level, 'html');
|
||||
} else {
|
||||
level = level || exports.defaultLevel;
|
||||
}
|
||||
|
||||
if (!options.url) {
|
||||
options.url = (module.parent.id === 'jsdom') ?
|
||||
module.parent.parent.filename :
|
||||
module.parent.filename;
|
||||
options.url = options.url.replace(/\\/g, '/');
|
||||
if (options.url[0] !== '/') {
|
||||
options.url = '/' + options.url;
|
||||
}
|
||||
options.url = 'file://' + options.url;
|
||||
}
|
||||
|
||||
var browser = exports.browserAugmentation(level, options),
|
||||
doc = (browser.HTMLDocument) ?
|
||||
new browser.HTMLDocument(options) :
|
||||
new browser.Document(options);
|
||||
|
||||
require('./jsdom/selectors/index').applyQuerySelectorPrototype(level);
|
||||
|
||||
features.applyDocumentFeatures(doc, options.features);
|
||||
|
||||
if (typeof html === 'undefined' || html === null ||
|
||||
(html.trim && !html.trim())) {
|
||||
doc.write('<html><head></head><body></body></html>');
|
||||
} else {
|
||||
doc.write(html + '');
|
||||
}
|
||||
|
||||
if (doc.close && !options.deferClose) {
|
||||
doc.close();
|
||||
}
|
||||
|
||||
// Kept for backwards-compatibility. The window is lazily created when
|
||||
// document.parentWindow or document.defaultView is accessed.
|
||||
doc.createWindow = function() {
|
||||
// Remove ourself
|
||||
if (doc.createWindow) {
|
||||
delete doc.createWindow;
|
||||
}
|
||||
return doc.parentWindow;
|
||||
};
|
||||
|
||||
return doc;
|
||||
};
|
||||
|
||||
exports.html = function(html, level, options) {
|
||||
html += '';
|
||||
|
||||
// TODO: cache a regex and use it here instead
|
||||
// or make the parser handle it
|
||||
var htmlLowered = html.toLowerCase();
|
||||
|
||||
// body
|
||||
if (!~htmlLowered.indexOf('<body')) {
|
||||
html = '<body>' + html + '</body>';
|
||||
}
|
||||
|
||||
// html
|
||||
if (!~htmlLowered.indexOf('<html')) {
|
||||
html = '<html>' + html + '</html>';
|
||||
}
|
||||
return exports.jsdom(html, level, options);
|
||||
};
|
||||
|
||||
exports.jQueryify = exports.jsdom.jQueryify = function (window /* path [optional], callback */) {
|
||||
|
||||
if (!window || !window.document) { return; }
|
||||
|
||||
var args = Array.prototype.slice.call(arguments),
|
||||
callback = (typeof(args[args.length - 1]) === 'function') && args.pop(),
|
||||
path,
|
||||
jQueryTag = window.document.createElement('script');
|
||||
jQueryTag.className = 'jsdom';
|
||||
|
||||
if (args.length > 1 && typeof(args[1] === 'string')) {
|
||||
path = args[1];
|
||||
}
|
||||
|
||||
var features = window.document.implementation._features;
|
||||
|
||||
window.document.implementation.addFeature('FetchExternalResources', ['script']);
|
||||
window.document.implementation.addFeature('ProcessExternalResources', ['script']);
|
||||
window.document.implementation.addFeature('MutationEvents', ['2.0']);
|
||||
jQueryTag.src = path || 'http://code.jquery.com/jquery-latest.js';
|
||||
window.document.body.appendChild(jQueryTag);
|
||||
|
||||
jQueryTag.onload = function() {
|
||||
if (callback) {
|
||||
callback(window, window.jQuery);
|
||||
}
|
||||
|
||||
window.document.implementation._features = features;
|
||||
};
|
||||
|
||||
return window;
|
||||
};
|
||||
|
||||
|
||||
exports.env = exports.jsdom.env = function () {
|
||||
var config = getConfigFromArguments(arguments);
|
||||
var callback = config.done;
|
||||
|
||||
if (config.file) {
|
||||
fs.readFile(config.file, 'utf-8', function (err, text) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
config.html = text;
|
||||
processHTML(config);
|
||||
});
|
||||
} else if (config.html) {
|
||||
processHTML(config);
|
||||
} else if (config.url) {
|
||||
handleUrl(config);
|
||||
} else if (config.somethingToAutodetect) {
|
||||
var url = URL.parse(config.somethingToAutodetect);
|
||||
if (url.protocol && url.hostname) {
|
||||
config.url = config.somethingToAutodetect;
|
||||
handleUrl(config.somethingToAutodetect);
|
||||
} else {
|
||||
fs.readFile(config.somethingToAutodetect, 'utf-8', function (err, text) {
|
||||
if (err) {
|
||||
if (err.code === 'ENOENT' || err.code === 'ENAMETOOLONG') {
|
||||
config.html = config.somethingToAutodetect;
|
||||
processHTML(config);
|
||||
} else {
|
||||
callback(err);
|
||||
}
|
||||
} else {
|
||||
config.html = text;
|
||||
config.url = toFileUrl(config.somethingToAutodetect);
|
||||
processHTML(config);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleUrl() {
|
||||
var options = {
|
||||
uri: config.url,
|
||||
encoding: config.encoding || 'utf8',
|
||||
headers: config.headers || {},
|
||||
proxy: config.proxy || null,
|
||||
jar: config.jar !== undefined ? config.jar : true
|
||||
};
|
||||
|
||||
request(options, function (err, res, responseText) {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
|
||||
// The use of `res.request.uri.href` ensures that `window.location.href`
|
||||
// is updated when `request` follows redirects.
|
||||
config.html = responseText;
|
||||
config.url = res.request.uri.href;
|
||||
processHTML(config);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
function processHTML(config) {
|
||||
var callback = config.done;
|
||||
var options = {
|
||||
features: config.features,
|
||||
url: config.url,
|
||||
parser: config.parser
|
||||
};
|
||||
|
||||
if (config.document) {
|
||||
options.referrer = config.document.referrer;
|
||||
options.cookie = config.document.cookie;
|
||||
options.cookieDomain = config.document.cookieDomain;
|
||||
}
|
||||
|
||||
var window = exports.html(config.html, null, options).createWindow();
|
||||
var features = JSON.parse(JSON.stringify(window.document.implementation._features));
|
||||
|
||||
var docsLoaded = 0;
|
||||
var totalDocs = config.scripts.length + config.src.length;
|
||||
var readyState = null;
|
||||
var errors = [];
|
||||
|
||||
if (!window || !window.document) {
|
||||
return callback(new Error('JSDOM: a window object could not be created.'));
|
||||
}
|
||||
|
||||
window.document.implementation.addFeature('FetchExternalResources', ['script']);
|
||||
window.document.implementation.addFeature('ProcessExternalResources', ['script']);
|
||||
window.document.implementation.addFeature('MutationEvents', ['2.0']);
|
||||
|
||||
function scriptComplete() {
|
||||
docsLoaded++;
|
||||
|
||||
if (docsLoaded >= totalDocs) {
|
||||
window.document.implementation._features = features;
|
||||
|
||||
errors = errors.concat(window.document.errors || []);
|
||||
if (errors.length === 0) {
|
||||
errors = null;
|
||||
}
|
||||
|
||||
process.nextTick(function() {
|
||||
callback(errors, window);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function handleScriptError(e) {
|
||||
if (!errors) {
|
||||
errors = [];
|
||||
}
|
||||
errors.push(e.error || e.message);
|
||||
|
||||
// nextTick so that an exception within scriptComplete won't cause
|
||||
// another script onerror (which would be an infinite loop)
|
||||
process.nextTick(scriptComplete);
|
||||
}
|
||||
|
||||
if (config.scripts.length > 0 || config.src.length > 0) {
|
||||
config.scripts.forEach(function (scriptSrc) {
|
||||
var script = window.document.createElement('script');
|
||||
script.className = 'jsdom';
|
||||
script.onload = scriptComplete;
|
||||
script.onerror = handleScriptError;
|
||||
script.src = scriptSrc;
|
||||
|
||||
try {
|
||||
// protect against invalid dom
|
||||
// ex: http://www.google.com/foo#bar
|
||||
window.document.documentElement.appendChild(script);
|
||||
} catch (e) {
|
||||
handleScriptError(e);
|
||||
}
|
||||
});
|
||||
|
||||
config.src.forEach(function (scriptText) {
|
||||
var script = window.document.createElement('script');
|
||||
script.onload = scriptComplete;
|
||||
script.onerror = handleScriptError;
|
||||
script.text = scriptText;
|
||||
|
||||
window.document.documentElement.appendChild(script);
|
||||
window.document.documentElement.removeChild(script);
|
||||
});
|
||||
} else {
|
||||
scriptComplete();
|
||||
}
|
||||
}
|
||||
|
||||
function getConfigFromArguments(args, callback) {
|
||||
var config = {};
|
||||
if (typeof args[0] === 'object') {
|
||||
var configToClone = args[0];
|
||||
Object.keys(configToClone).forEach(function (key) {
|
||||
config[key] = configToClone[key];
|
||||
});
|
||||
} else {
|
||||
var stringToAutodetect = null;
|
||||
|
||||
Array.prototype.forEach.call(args, function (arg) {
|
||||
switch (typeof arg) {
|
||||
case 'string':
|
||||
config.somethingToAutodetect = arg;
|
||||
break;
|
||||
case 'function':
|
||||
config.done = arg;
|
||||
break;
|
||||
case 'object':
|
||||
if (Array.isArray(arg)) {
|
||||
config.scripts = arg;
|
||||
} else {
|
||||
extend(config, arg);
|
||||
}
|
||||
break;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (!config.done) {
|
||||
throw new Error('Must pass a "done" option or a callback to jsdom.env.');
|
||||
}
|
||||
|
||||
if (!config.somethingToAutodetect && !config.html && !config.file && !config.url) {
|
||||
throw new Error('Must pass a "html", "file", or "url" option, or a string, to jsdom.env');
|
||||
}
|
||||
|
||||
config.scripts = ensureArray(config.scripts);
|
||||
config.src = ensureArray(config.src);
|
||||
|
||||
config.features = config.features || {
|
||||
FetchExternalResources: false,
|
||||
ProcessExternalResources: false,
|
||||
SkipExternalResources: false
|
||||
};
|
||||
|
||||
if (!config.url && config.file) {
|
||||
config.url = toFileUrl(config.file);
|
||||
}
|
||||
|
||||
return config;
|
||||
}
|
||||
|
||||
function ensureArray(value) {
|
||||
var array = value || [];
|
||||
if (typeof array === 'string') {
|
||||
array = [array];
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
function extend(config, overrides) {
|
||||
Object.keys(overrides).forEach(function (key) {
|
||||
config[key] = overrides[key];
|
||||
});
|
||||
}
|
@ -1,52 +0,0 @@
|
||||
exports.availableDocumentFeatures = [
|
||||
'FetchExternalResources',
|
||||
'ProcessExternalResources',
|
||||
'MutationEvents',
|
||||
'SkipExternalResources'
|
||||
];
|
||||
|
||||
exports.defaultDocumentFeatures = {
|
||||
"FetchExternalResources": ['script', 'link'/*, 'img', 'css', 'frame'*/],
|
||||
"ProcessExternalResources": ['script'/*, 'frame', 'iframe'*/],
|
||||
"MutationEvents": '2.0',
|
||||
"SkipExternalResources": false
|
||||
};
|
||||
|
||||
exports.applyDocumentFeatures = function(doc, features) {
|
||||
var i, maxFeatures = exports.availableDocumentFeatures.length,
|
||||
defaultFeatures = exports.defaultDocumentFeatures,
|
||||
j,
|
||||
k,
|
||||
featureName,
|
||||
featureSource;
|
||||
|
||||
features = features || {};
|
||||
|
||||
for (i=0; i<maxFeatures; i++) {
|
||||
featureName = exports.availableDocumentFeatures[i];
|
||||
if (typeof features[featureName] !== 'undefined') {
|
||||
featureSource = features[featureName];
|
||||
// We have to check the lowercase version also because the Document feature
|
||||
// methods convert everything to lowercase.
|
||||
} else if (typeof features[featureName.toLowerCase()] !== 'undefined') {
|
||||
featureSource = features[featureName.toLowerCase()];
|
||||
} else if (defaultFeatures[featureName]) {
|
||||
featureSource = defaultFeatures[featureName];
|
||||
} else {
|
||||
continue;
|
||||
}
|
||||
|
||||
doc.implementation.removeFeature(featureName);
|
||||
|
||||
if (typeof featureSource !== 'undefined') {
|
||||
if (featureSource instanceof Array) {
|
||||
k = featureSource.length;
|
||||
for (j=0; j<k; j++) {
|
||||
doc.implementation.addFeature(featureName, featureSource[j]);
|
||||
}
|
||||
} else {
|
||||
doc.implementation.addFeature(featureName, featureSource);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
@ -1,179 +0,0 @@
|
||||
//List from htmlparser2
|
||||
var voidElements = {
|
||||
area: true,
|
||||
base: true,
|
||||
basefont: true,
|
||||
br: true,
|
||||
col: true,
|
||||
command: true,
|
||||
embed: true,
|
||||
frame: true,
|
||||
hr: true,
|
||||
img: true,
|
||||
input: true,
|
||||
isindex: true,
|
||||
keygen: true,
|
||||
link: true,
|
||||
meta: true,
|
||||
param: true,
|
||||
source: true,
|
||||
track: true,
|
||||
wbr: true
|
||||
};
|
||||
|
||||
var expr = {
|
||||
upperCaseChars: /([A-Z])/g,
|
||||
breakBetweenTags: /(<(\/?\w+).*?>)(?=<(?!\/\2))/gi,
|
||||
voidElement: (function() {
|
||||
var tags = [];
|
||||
for (var i in voidElements) {
|
||||
tags.push(i);
|
||||
}
|
||||
return new RegExp('<' + tags.join('|<'), 'i');
|
||||
})()
|
||||
};
|
||||
|
||||
var uncanon = function(str, letter) {
|
||||
return '-' + letter.toLowerCase();
|
||||
};
|
||||
|
||||
var HTMLEncode = require('./htmlencoding').HTMLEncode;
|
||||
|
||||
exports.stringifyElement = function stringifyElement(element) {
|
||||
var tagName = element.tagName.toLowerCase(),
|
||||
ret = {
|
||||
start: "<" + tagName,
|
||||
end:''
|
||||
},
|
||||
attributes = [],
|
||||
i,
|
||||
attribute = null;
|
||||
|
||||
if (element.attributes.length) {
|
||||
ret.start += " ";
|
||||
for (i = 0; i<element.attributes.length; i++) {
|
||||
attribute = element.attributes.item(i);
|
||||
attributes.push(attribute.name + '="' +
|
||||
HTMLEncode(attribute.nodeValue, true) + '"');
|
||||
}
|
||||
}
|
||||
ret.start += attributes.join(" ");
|
||||
|
||||
if (voidElements[tagName]) {
|
||||
ret.start += ">";
|
||||
ret.end = '';
|
||||
} else {
|
||||
ret.start += ">";
|
||||
ret.end = "</" + tagName + ">";
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
var rawTextElements = /SCRIPT|STYLE/i;
|
||||
|
||||
function stringifyDoctype (doctype) {
|
||||
if (doctype.ownerDocument && doctype.ownerDocument._fullDT) {
|
||||
return doctype.ownerDocument._fullDT;
|
||||
}
|
||||
|
||||
var dt = '<!DOCTYPE ' + doctype.name;
|
||||
if (doctype.publicId) {
|
||||
// Public ID may never contain double quotes, so this is always safe.
|
||||
dt += ' PUBLIC "' + doctype.publicId + '" ';
|
||||
}
|
||||
if (!doctype.publicId && doctype.systemId) {
|
||||
dt += ' SYSTEM ';
|
||||
}
|
||||
if (doctype.systemId) {
|
||||
// System ID may contain double quotes OR single quotes, not never both.
|
||||
if (doctype.systemId.indexOf('"') > -1) {
|
||||
dt += "'" + doctype.systemId + "'";
|
||||
} else {
|
||||
dt += '"' + doctype.systemId + '"';
|
||||
}
|
||||
}
|
||||
dt += '>';
|
||||
return dt;
|
||||
}
|
||||
|
||||
exports.makeHtmlGenerator = function makeHtmlGenerator(indentUnit, eol) {
|
||||
indentUnit = indentUnit || "";
|
||||
eol = eol || "";
|
||||
|
||||
return function generateHtmlRecursive(node, rawText, curIndent) {
|
||||
var ret = "", parent, current, i;
|
||||
curIndent = curIndent || "";
|
||||
if (node) {
|
||||
if (node.nodeType &&
|
||||
node.nodeType === node.ENTITY_REFERENCE_NODE) {
|
||||
node = node._entity;
|
||||
}
|
||||
|
||||
var childNodesRawText = rawText || rawTextElements.test(node.nodeName);
|
||||
|
||||
switch (node.nodeType) {
|
||||
case node.ELEMENT_NODE:
|
||||
current = exports.stringifyElement(node);
|
||||
if (childNodesRawText) {
|
||||
ret += curIndent + current.start;
|
||||
} else {
|
||||
ret += curIndent + current.start;
|
||||
}
|
||||
var len = node._childNodes.length;
|
||||
if (len > 0) {
|
||||
if (node._childNodes[0].nodeType !== node.TEXT_NODE) {
|
||||
ret += eol;
|
||||
}
|
||||
for (i=0; i<len; i++) {
|
||||
ret += generateHtmlRecursive(node._childNodes[i], childNodesRawText, curIndent + indentUnit);
|
||||
}
|
||||
if (node._childNodes[len - 1].nodeType !== node.TEXT_NODE) {
|
||||
ret += curIndent;
|
||||
}
|
||||
ret += current.end + eol;
|
||||
} else {
|
||||
ret += ((rawText ? node.nodeValue : HTMLEncode(node.nodeValue, false)) || '') + current.end + eol;
|
||||
}
|
||||
break;
|
||||
case node.TEXT_NODE:
|
||||
// Skip pure whitespace nodes if we're indenting
|
||||
if (!indentUnit || !/^[\s\n]*$/.test(node.nodeValue)) {
|
||||
ret += (rawText ? node.nodeValue : HTMLEncode(node.nodeValue, false)) || '';
|
||||
}
|
||||
break;
|
||||
case node.COMMENT_NODE:
|
||||
ret += curIndent + '<!--' + node.nodeValue + '-->' + eol;
|
||||
break;
|
||||
case node.DOCUMENT_NODE:
|
||||
for (i=0; i<node._childNodes.length; i++) {
|
||||
ret += generateHtmlRecursive(node._childNodes[i], childNodesRawText, curIndent);
|
||||
}
|
||||
break;
|
||||
case node.DOCUMENT_TYPE_NODE:
|
||||
ret += stringifyDoctype(node);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
};
|
||||
|
||||
exports.domToHtml = function(dom, noformat, raw) {
|
||||
var htmlGenerator = exports.makeHtmlGenerator(noformat ? "" : " ",
|
||||
noformat ? "" : "\n");
|
||||
if (dom._toArray) {
|
||||
// node list
|
||||
dom = dom._toArray();
|
||||
}
|
||||
if (typeof dom.length !== 'undefined') {
|
||||
var ret = "";
|
||||
for (var i=0,len=dom.length; i<len; i++) {
|
||||
ret += htmlGenerator(dom[i], raw);
|
||||
}
|
||||
return ret;
|
||||
} else {
|
||||
// single node
|
||||
return htmlGenerator(dom, raw);
|
||||
}
|
||||
};
|
@ -1,92 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var URL = require('url');
|
||||
|
||||
function StateEntry(data, title, url) {
|
||||
this.data = data;
|
||||
this.title = title;
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
module.exports = History;
|
||||
|
||||
function History(window) {
|
||||
this._states = [];
|
||||
this._index = -1;
|
||||
this._window = window;
|
||||
this._location = window.location;
|
||||
}
|
||||
|
||||
History.prototype = {
|
||||
constructor: History,
|
||||
|
||||
get length() {
|
||||
return this._states.length;
|
||||
},
|
||||
|
||||
get state() {
|
||||
var state = this._states[this._index];
|
||||
return state ? state.data : null;
|
||||
},
|
||||
|
||||
back: function () {
|
||||
this.go(-1);
|
||||
},
|
||||
|
||||
forward: function () {
|
||||
this.go(1);
|
||||
},
|
||||
|
||||
go: function (delta) {
|
||||
if (typeof delta === "undefined" || delta === 0) {
|
||||
this._location.reload();
|
||||
return;
|
||||
}
|
||||
|
||||
var newIndex = this._index + delta;
|
||||
|
||||
if (newIndex < 0 || newIndex >= this.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._index = newIndex;
|
||||
this._applyState(this._states[this._index]);
|
||||
},
|
||||
|
||||
pushState: function (data, title, url) {
|
||||
var state = new StateEntry(data, title, url);
|
||||
if (this._index + 1 !== this._states.length) {
|
||||
this._states = this._states.slice(0, this._index + 1);
|
||||
}
|
||||
this._states.push(state);
|
||||
this._applyState(state);
|
||||
this._index++;
|
||||
},
|
||||
|
||||
replaceState: function (data, title, url) {
|
||||
var state = new StateEntry(data, title, url);
|
||||
this._states[this._index] = state;
|
||||
this._applyState(state);
|
||||
},
|
||||
|
||||
_applyState: function(state) {
|
||||
this._location._url = URL.parse(URL.resolve(this._location._url.href, state.url));
|
||||
|
||||
this._signalPopstate(state);
|
||||
},
|
||||
|
||||
_signalPopstate: function(state) {
|
||||
if (this._window.document) {
|
||||
var ev = this._window.document.createEvent("HTMLEvents");
|
||||
ev.initEvent("popstate", false, false);
|
||||
ev.state = state.data;
|
||||
process.nextTick(function () {
|
||||
this._window.dispatchEvent(ev);
|
||||
}.bind(this));
|
||||
}
|
||||
},
|
||||
|
||||
toString: function () {
|
||||
return "[object History]";
|
||||
}
|
||||
};
|
1506
bower_components/jsdom/lib/jsdom/browser/htmlencoding.js
vendored
1506
bower_components/jsdom/lib/jsdom/browser/htmlencoding.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,194 +0,0 @@
|
||||
var HTMLDecode = require('./htmlencoding').HTMLDecode;
|
||||
|
||||
function HtmlToDom(parser) {
|
||||
|
||||
if(parser && parser.write) {
|
||||
// sax parser
|
||||
this.appendHtmlToElement = function(html, element){
|
||||
|
||||
var currentElement = element, currentLevel = 0;
|
||||
|
||||
parser.onerror = function (e) {};
|
||||
|
||||
parser.ontext = function (t) {
|
||||
var ownerDocument = currentElement.ownerDocument || currentElement;
|
||||
var newText = ownerDocument.createTextNode(t);
|
||||
currentElement.appendChild(newText);
|
||||
};
|
||||
|
||||
parser.onopentag = function (node) {
|
||||
var nodeName = node.name.toLowerCase(),
|
||||
document = currentElement.ownerDocument || currentElement,
|
||||
newElement = document.createElement(nodeName),
|
||||
i = 0,
|
||||
length = (node.attributes && node.attributes.length) ?
|
||||
node.attributes.length :
|
||||
0;
|
||||
|
||||
for (i in node.attributes) {
|
||||
if (node.attributes.hasOwnProperty(i)) {
|
||||
newElement.setAttribute(i, node.attributes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
for (i=0; i<node.attributes.length; i++) {
|
||||
newElement.setAttribute(i, node.attributes.item(i));
|
||||
}
|
||||
currentElement.appendChild(newElement);
|
||||
currentElement = newElement;
|
||||
};
|
||||
|
||||
parser.onclosetag = function(node) {
|
||||
currentElement = currentElement.parentNode;
|
||||
};
|
||||
|
||||
parser.write(html).close();
|
||||
|
||||
return element;
|
||||
};
|
||||
|
||||
} else if (parser && (parser.ParseHtml || parser.DefaultHandler)) {
|
||||
|
||||
// Forgiving HTML parser
|
||||
|
||||
if (parser.ParseHtml) {
|
||||
// davglass/node-htmlparser
|
||||
} else if (parser.DefaultHandler){
|
||||
// fb55/htmlparser2
|
||||
|
||||
parser.ParseHtml = function(rawHtml) {
|
||||
var handler = new parser.DefaultHandler();
|
||||
// Check if document is XML
|
||||
var isXML = (/^<\?\s*xml.*version=["']1\.0["'].*\s*\?>/i).test(rawHtml);
|
||||
var parserInstance = new parser.Parser(handler, {
|
||||
xmlMode: isXML,
|
||||
lowerCaseTags: !isXML,
|
||||
lowerCaseAttributeNames: !isXML
|
||||
});
|
||||
|
||||
parserInstance.includeLocation = false;
|
||||
parserInstance.parseComplete(rawHtml);
|
||||
return handler.dom;
|
||||
};
|
||||
}
|
||||
|
||||
this.appendHtmlToElement = function(html, element) {
|
||||
|
||||
if (typeof html !== 'string') {
|
||||
html +='';
|
||||
}
|
||||
|
||||
var parsed = parser.ParseHtml(html);
|
||||
|
||||
for (var i = 0; i < parsed.length; i++) {
|
||||
setChild(element, parsed[i]);
|
||||
}
|
||||
|
||||
return element;
|
||||
};
|
||||
|
||||
} else if (parser && parser.moduleName == 'HTML5') { /* HTML5 parser */
|
||||
this.appendHtmlToElement = function(html, element) {
|
||||
|
||||
if (typeof html !== 'string') {
|
||||
html += '';
|
||||
}
|
||||
if (html.length > 0) {
|
||||
if (element.nodeType == 9) {
|
||||
new parser.Parser({document: element}).parse(html);
|
||||
}
|
||||
else {
|
||||
var p = new parser.Parser({document: element.ownerDocument});
|
||||
p.parse_fragment(html, element);
|
||||
}
|
||||
}
|
||||
};
|
||||
} else {
|
||||
|
||||
this.appendHtmlToElement = function(){
|
||||
console.log('');
|
||||
console.log('###########################################################');
|
||||
console.log('# WARNING: No HTML parser could be found.');
|
||||
console.log('# Element.innerHTML setter support has been disabled');
|
||||
console.log('# Element.innerHTML getter support will still function');
|
||||
console.log('# Download: http://github.com/tautologistics/node-htmlparser');
|
||||
console.log('###########################################################');
|
||||
console.log('');
|
||||
};
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
// utility function for forgiving parser
|
||||
function setChild(parent, node) {
|
||||
|
||||
var c, newNode, currentDocument = parent._ownerDocument || parent;
|
||||
|
||||
switch (node.type)
|
||||
{
|
||||
case 'tag':
|
||||
case 'script':
|
||||
case 'style':
|
||||
try {
|
||||
newNode = currentDocument.createElement(node.name);
|
||||
if (node.location) {
|
||||
newNode.sourceLocation = node.location;
|
||||
newNode.sourceLocation.file = parent.sourceLocation.file;
|
||||
}
|
||||
} catch (err) {
|
||||
currentDocument.raise('error', 'invalid markup', {
|
||||
exception: err,
|
||||
node : node
|
||||
});
|
||||
|
||||
return null;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'text':
|
||||
// Decode HTML entities if we're not inside a <script> or <style> tag:
|
||||
newNode = currentDocument.createTextNode(/^(?:script|style)$/i.test(parent.nodeName) ?
|
||||
node.data :
|
||||
HTMLDecode(node.data));
|
||||
break;
|
||||
|
||||
case 'comment':
|
||||
newNode = currentDocument.createComment(node.data);
|
||||
break;
|
||||
|
||||
default:
|
||||
return null;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!newNode)
|
||||
return null;
|
||||
|
||||
if (node.attribs) {
|
||||
for (c in node.attribs) {
|
||||
// catchin errors here helps with improperly escaped attributes
|
||||
// but properly fixing parent should (can only?) be done in the htmlparser itself
|
||||
try {
|
||||
newNode.setAttribute(c, HTMLDecode(node.attribs[c]));
|
||||
} catch(e2) { /* noop */ }
|
||||
}
|
||||
}
|
||||
|
||||
if (node.children) {
|
||||
for (c = 0; c < node.children.length; c++) {
|
||||
setChild(newNode, node.children[c]);
|
||||
}
|
||||
}
|
||||
|
||||
try{
|
||||
return parent.appendChild(newNode);
|
||||
}catch(err){
|
||||
currentDocument.raise('error', err.message, {
|
||||
exception: err,
|
||||
node : node
|
||||
});
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
exports.HtmlToDom = HtmlToDom;
|
633
bower_components/jsdom/lib/jsdom/browser/index.js
vendored
633
bower_components/jsdom/lib/jsdom/browser/index.js
vendored
@ -1,633 +0,0 @@
|
||||
var http = require('http'),
|
||||
URL = require('url'),
|
||||
HtmlToDom = require('./htmltodom').HtmlToDom,
|
||||
domToHtml = require('./domtohtml').domToHtml,
|
||||
htmlencoding = require('./htmlencoding'),
|
||||
HTMLEncode = htmlencoding.HTMLEncode,
|
||||
HTMLDecode = htmlencoding.HTMLDecode,
|
||||
jsdom = require('../../jsdom'),
|
||||
Location = require('./location'),
|
||||
History = require('./history'),
|
||||
NOT_IMPLEMENTED = require('./utils').NOT_IMPLEMENTED,
|
||||
CSSStyleDeclaration = require('cssstyle').CSSStyleDeclaration,
|
||||
toFileUrl = require('../utils').toFileUrl,
|
||||
defineGetter = require('../utils').defineGetter,
|
||||
defineSetter = require('../utils').defineSetter,
|
||||
createFrom = require('../utils').createFrom,
|
||||
Contextify = require('contextify');
|
||||
|
||||
function matchesDontThrow(el, selector) {
|
||||
try {
|
||||
return el.matchesSelector(selector);
|
||||
} catch (e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a window having a document. The document can be passed as option,
|
||||
* if omitted, a new document will be created.
|
||||
*/
|
||||
exports.windowAugmentation = function(dom, options) {
|
||||
options = options || {};
|
||||
var window = exports.createWindow(dom, options);
|
||||
|
||||
if (!options.document) {
|
||||
var browser = browserAugmentation(dom, options);
|
||||
|
||||
options.document = (browser.HTMLDocument) ?
|
||||
new browser.HTMLDocument(options) :
|
||||
new browser.Document(options);
|
||||
|
||||
|
||||
|
||||
options.document.write('<html><head></head><body></body></html>');
|
||||
}
|
||||
|
||||
var doc = window.document = options.document;
|
||||
|
||||
if (doc.addEventListener) {
|
||||
if (doc.readyState == 'complete') {
|
||||
var ev = doc.createEvent('HTMLEvents');
|
||||
ev.initEvent('load', false, false);
|
||||
process.nextTick(function () {
|
||||
window.dispatchEvent(ev);
|
||||
});
|
||||
}
|
||||
else {
|
||||
doc.addEventListener('load', function(ev) {
|
||||
window.dispatchEvent(ev);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return window;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a document-less window.
|
||||
*/
|
||||
exports.createWindow = function(dom, options) {
|
||||
var timers = [];
|
||||
var cssSelectorSplitRE = /((?:[^,"']|"[^"]*"|'[^']*')+)/;
|
||||
|
||||
function startTimer(startFn, stopFn, callback, ms) {
|
||||
var res = startFn(callback, ms);
|
||||
timers.push( [ res, stopFn ] );
|
||||
return res;
|
||||
}
|
||||
|
||||
function stopTimer(id) {
|
||||
if (typeof id === 'undefined') {
|
||||
return;
|
||||
}
|
||||
for (var i in timers) {
|
||||
if (timers[i][0] === id) {
|
||||
timers[i][1].call(this, id);
|
||||
timers.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function stopAllTimers() {
|
||||
timers.forEach(function (t) {
|
||||
t[1].call(this, t[0]);
|
||||
});
|
||||
timers = [];
|
||||
}
|
||||
|
||||
function DOMWindow(options) {
|
||||
var url = (options || {}).url || toFileUrl(__filename);
|
||||
this.location = new Location(url, this);
|
||||
this.history = new History(this);
|
||||
|
||||
this.console._window = this;
|
||||
|
||||
if (options && options.document) {
|
||||
options.document.location = this.location;
|
||||
}
|
||||
|
||||
this.addEventListener = function() {
|
||||
dom.Node.prototype.addEventListener.apply(window, arguments);
|
||||
};
|
||||
this.removeEventListener = function() {
|
||||
dom.Node.prototype.removeEventListener.apply(window, arguments);
|
||||
};
|
||||
this.dispatchEvent = function() {
|
||||
dom.Node.prototype.dispatchEvent.apply(window, arguments);
|
||||
};
|
||||
this.raise = function(){
|
||||
dom.Node.prototype.raise.apply(window.document, arguments);
|
||||
};
|
||||
|
||||
this.setTimeout = function (fn, ms) { return startTimer(setTimeout, clearTimeout, fn, ms); };
|
||||
this.setInterval = function (fn, ms) { return startTimer(setInterval, clearInterval, fn, ms); };
|
||||
this.clearInterval = stopTimer;
|
||||
this.clearTimeout = stopTimer;
|
||||
this.__stopAllTimers = stopAllTimers;
|
||||
}
|
||||
|
||||
DOMWindow.prototype = createFrom(dom || null, {
|
||||
constructor: DOMWindow,
|
||||
// This implements window.frames.length, since window.frames returns a
|
||||
// self reference to the window object. This value is incremented in the
|
||||
// HTMLFrameElement init function (see: level2/html.js).
|
||||
_length : 0,
|
||||
get length () {
|
||||
return this._length;
|
||||
},
|
||||
close : function() {
|
||||
// Recursively close child frame windows, then ourselves.
|
||||
var currentWindow = this;
|
||||
(function windowCleaner (window) {
|
||||
var i;
|
||||
// We could call window.frames.length etc, but window.frames just points
|
||||
// back to window.
|
||||
if (window.length > 0) {
|
||||
for (i = 0; i < window.length; i++) {
|
||||
windowCleaner(window[i]);
|
||||
}
|
||||
}
|
||||
// We're already in our own window.close().
|
||||
if (window !== currentWindow) {
|
||||
window.close();
|
||||
}
|
||||
})(this);
|
||||
|
||||
if (this.document) {
|
||||
if (this.document.body) {
|
||||
this.document.body.innerHTML = "";
|
||||
}
|
||||
|
||||
if (this.document.close) {
|
||||
// We need to empty out the event listener array because
|
||||
// document.close() causes 'load' event to re-fire.
|
||||
this.document._listeners = [];
|
||||
this.document.close();
|
||||
}
|
||||
delete this.document;
|
||||
}
|
||||
|
||||
stopAllTimers();
|
||||
// Clean up the window's execution context.
|
||||
// dispose() is added by Contextify.
|
||||
this.dispose();
|
||||
},
|
||||
getComputedStyle: function(node) {
|
||||
var s = node.style,
|
||||
cs = new CSSStyleDeclaration(),
|
||||
forEach = Array.prototype.forEach;
|
||||
|
||||
function setPropertiesFromRule(rule) {
|
||||
if (!rule.selectorText) {
|
||||
return;
|
||||
}
|
||||
|
||||
var selectors = rule.selectorText.split(cssSelectorSplitRE);
|
||||
var matched = false;
|
||||
selectors.forEach(function (selectorText) {
|
||||
if (selectorText !== '' && selectorText !== ',' && !matched && matchesDontThrow(node, selectorText)) {
|
||||
matched = true;
|
||||
forEach.call(rule.style, function (property) {
|
||||
cs.setProperty(property, rule.style.getPropertyValue(property), rule.style.getPropertyPriority(property));
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
forEach.call(node.ownerDocument.styleSheets, function (sheet) {
|
||||
forEach.call(sheet.cssRules, function (rule) {
|
||||
if (rule.media) {
|
||||
if (Array.prototype.indexOf.call(rule.media, 'screen') !== -1) {
|
||||
forEach.call(rule.cssRules, setPropertiesFromRule);
|
||||
}
|
||||
} else {
|
||||
setPropertiesFromRule(rule);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
forEach.call(s, function (property) {
|
||||
cs.setProperty(property, s.getPropertyValue(property), s.getPropertyPriority(property));
|
||||
});
|
||||
|
||||
return cs;
|
||||
},
|
||||
console: {
|
||||
log: function(message) { this._window.raise('log', message) },
|
||||
info: function(message) { this._window.raise('info', message) },
|
||||
warn: function(message) { this._window.raise('warn', message) },
|
||||
error: function(message) { this._window.raise('error', message) }
|
||||
},
|
||||
navigator: {
|
||||
userAgent: 'Node.js (' + process.platform + '; U; rv:' + process.version + ')',
|
||||
appName: 'Node.js jsDom',
|
||||
platform: process.platform,
|
||||
appVersion: process.version,
|
||||
noUI: true
|
||||
},
|
||||
XMLHttpRequest: function() {
|
||||
var XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
|
||||
var xhr = new XMLHttpRequest();
|
||||
var lastUrl = '';
|
||||
xhr._open = xhr.open;
|
||||
xhr.open = function(method, url, async, user, password) {
|
||||
url = URL.resolve(options.url, url);
|
||||
lastUrl = url;
|
||||
return xhr._open(method, url, async, user, password);
|
||||
};
|
||||
xhr._send = xhr.send;
|
||||
xhr.send = function(data) {
|
||||
if (window.document.cookie) {
|
||||
var cookieDomain = window.document._cookieDomain;
|
||||
var url = URL.parse(lastUrl);
|
||||
var host = url.host.split(':')[0];
|
||||
if (host.indexOf(cookieDomain, host.length - cookieDomain.length) !== -1) {
|
||||
xhr.setDisableHeaderCheck(true);
|
||||
xhr.setRequestHeader('cookie', window.document.cookie);
|
||||
xhr.setDisableHeaderCheck(false);
|
||||
}
|
||||
}
|
||||
return xhr._send(data);
|
||||
};
|
||||
return xhr;
|
||||
},
|
||||
|
||||
name: 'nodejs',
|
||||
innerWidth: 1024,
|
||||
innerHeight: 768,
|
||||
outerWidth: 1024,
|
||||
outerHeight: 768,
|
||||
pageXOffset: 0,
|
||||
pageYOffset: 0,
|
||||
screenX: 0,
|
||||
screenY: 0,
|
||||
screenLeft: 0,
|
||||
screenTop: 0,
|
||||
scrollX: 0,
|
||||
scrollY: 0,
|
||||
scrollTop: 0,
|
||||
scrollLeft: 0,
|
||||
alert: NOT_IMPLEMENTED(null, 'window.alert'),
|
||||
blur: NOT_IMPLEMENTED(null, 'window.blur'),
|
||||
confirm: NOT_IMPLEMENTED(null, 'window.confirm'),
|
||||
createPopup: NOT_IMPLEMENTED(null, 'window.createPopup'),
|
||||
focus: NOT_IMPLEMENTED(null, 'window.focus'),
|
||||
moveBy: NOT_IMPLEMENTED(null, 'window.moveBy'),
|
||||
moveTo: NOT_IMPLEMENTED(null, 'window.moveTo'),
|
||||
open: NOT_IMPLEMENTED(null, 'window.open'),
|
||||
print: NOT_IMPLEMENTED(null, 'window.print'),
|
||||
prompt: NOT_IMPLEMENTED(null, 'window.prompt'),
|
||||
resizeBy: NOT_IMPLEMENTED(null, 'window.resizeBy'),
|
||||
resizeTo: NOT_IMPLEMENTED(null, 'window.resizeTo'),
|
||||
scroll: NOT_IMPLEMENTED(null, 'window.scroll'),
|
||||
scrollBy: NOT_IMPLEMENTED(null, 'window.scrollBy'),
|
||||
scrollTo: NOT_IMPLEMENTED(null, 'window.scrollTo'),
|
||||
screen : {
|
||||
width : 0,
|
||||
height : 0
|
||||
},
|
||||
Image : NOT_IMPLEMENTED(null, 'window.Image'),
|
||||
|
||||
// Note: these will not be necessary for newer Node.js versions, which have
|
||||
// typed arrays in V8 and thus on every global object. (That is, in newer
|
||||
// versions we'll get `ArrayBuffer` just as automatically as we get
|
||||
// `Array`.) But to support older versions, we explicitly set them here.
|
||||
Int8Array: global.Int8Array,
|
||||
Int16Array: global.Int16Array,
|
||||
Int32Array: global.Int32Array,
|
||||
Float32Array: global.Float32Array,
|
||||
Float64Array: global.Float64Array,
|
||||
Uint8Array: global.Uint8Array,
|
||||
Uint8ClampedArray: global.Uint8ClampedArray,
|
||||
Uint16Array: global.Uint16Array,
|
||||
Uint32Array: global.Uint32Array,
|
||||
ArrayBuffer: global.ArrayBuffer
|
||||
});
|
||||
|
||||
var window = new DOMWindow(options);
|
||||
|
||||
Contextify(window);
|
||||
|
||||
// We need to set up self references using Contextify's getGlobal() so that
|
||||
// the global object identity is correct (window === this).
|
||||
// See Contextify README for more info.
|
||||
var windowGlobal = window.getGlobal();
|
||||
|
||||
// Set up the window as if it's a top level window.
|
||||
// If it's not, then references will be corrected by frame/iframe code.
|
||||
// Note: window.frames is maintained in the HTMLFrameElement init function.
|
||||
window.window = window.frames
|
||||
= window.self
|
||||
= window.parent
|
||||
= window.top = windowGlobal;
|
||||
|
||||
return window;
|
||||
};
|
||||
|
||||
//Caching for HTMLParser require. HUGE performace boost.
|
||||
/**
|
||||
* 5000 iterations
|
||||
* Without cache: ~1800+ms
|
||||
* With cache: ~80ms
|
||||
*/
|
||||
// TODO: is this even needed in modern Node.js versions?
|
||||
var defaultParser = null;
|
||||
var getDefaultParser = exports.getDefaultParser = function () {
|
||||
if (defaultParser === null) {
|
||||
defaultParser = require('htmlparser2');
|
||||
}
|
||||
return defaultParser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Export getter/setter of default parser to facilitate testing
|
||||
* with different HTML parsers.
|
||||
*/
|
||||
exports.setDefaultParser = function (parser) {
|
||||
if (typeof parser == 'object') {
|
||||
defaultParser = parser;
|
||||
} else if (typeof parser == 'string')
|
||||
defaultParser = require(parser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Augments the given DOM by adding browser-specific properties and methods (BOM).
|
||||
* Returns the augmented DOM.
|
||||
*/
|
||||
var browserAugmentation = exports.browserAugmentation = function(dom, options) {
|
||||
|
||||
if(!options) {
|
||||
options = {};
|
||||
}
|
||||
|
||||
// set up html parser - use a provided one or try and load from library
|
||||
var parser = options.parser || getDefaultParser();
|
||||
|
||||
if (dom._augmented && dom._parser === parser) {
|
||||
return dom;
|
||||
}
|
||||
|
||||
dom._parser = parser;
|
||||
var htmltodom = new HtmlToDom(parser);
|
||||
|
||||
if (!dom.HTMLDocument) {
|
||||
dom.HTMLDocument = dom.Document;
|
||||
}
|
||||
if (!dom.HTMLDocument.prototype.write) {
|
||||
dom.HTMLDocument.prototype.write = function(html) {
|
||||
this.innerHTML = html;
|
||||
};
|
||||
}
|
||||
|
||||
dom.Element.prototype.getElementsByClassName = function(className) {
|
||||
|
||||
function filterByClassName(child) {
|
||||
if (!child) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (child.nodeType &&
|
||||
child.nodeType === dom.Node.ENTITY_REFERENCE_NODE)
|
||||
{
|
||||
child = child._entity;
|
||||
}
|
||||
|
||||
var classString = child.className;
|
||||
if (classString) {
|
||||
var s = classString.split(" ");
|
||||
for (var i=0; i<s.length; i++) {
|
||||
if (s[i] === className) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return new dom.NodeList(this.ownerDocument || this, dom.mapper(this, filterByClassName));
|
||||
};
|
||||
|
||||
defineGetter(dom.Element.prototype, 'sourceIndex', function() {
|
||||
/*
|
||||
* According to QuirksMode:
|
||||
* Get the sourceIndex of element x. This is also the index number for
|
||||
* the element in the document.getElementsByTagName('*') array.
|
||||
* http://www.quirksmode.org/dom/w3c_core.html#t77
|
||||
*/
|
||||
var items = this.ownerDocument.getElementsByTagName('*'),
|
||||
len = items.length;
|
||||
|
||||
for (var i = 0; i < len; i++) {
|
||||
if (items[i] === this) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
defineGetter(dom.Document.prototype, 'outerHTML', function() {
|
||||
return domToHtml(this, true);
|
||||
});
|
||||
|
||||
defineGetter(dom.Element.prototype, 'outerHTML', function() {
|
||||
return domToHtml(this, true);
|
||||
});
|
||||
|
||||
defineGetter(dom.Element.prototype, 'innerHTML', function() {
|
||||
if (/^(?:script|style)$/.test(this._tagName)) {
|
||||
var type = this.getAttribute('type');
|
||||
if (!type || /^text\//i.test(type) || /\/javascript$/i.test(type)) {
|
||||
return domToHtml(this._childNodes, true, true);
|
||||
}
|
||||
}
|
||||
|
||||
return domToHtml(this._childNodes, true);
|
||||
});
|
||||
|
||||
defineSetter(dom.Element.prototype, 'doctype', function() {
|
||||
throw new dom.DOMException(dom.NO_MODIFICATION_ALLOWED_ERR);
|
||||
});
|
||||
defineGetter(dom.Element.prototype, 'doctype', function() {
|
||||
var r = null;
|
||||
if (this.nodeName == '#document') {
|
||||
if (this._doctype) {
|
||||
r = this._doctype;
|
||||
}
|
||||
}
|
||||
return r;
|
||||
});
|
||||
|
||||
defineSetter(dom.Element.prototype, 'innerHTML', function(html) {
|
||||
//Clear the children first:
|
||||
var child;
|
||||
while ((child = this._childNodes[0])) {
|
||||
this.removeChild(child);
|
||||
}
|
||||
|
||||
if (this.nodeName === '#document') {
|
||||
parseDocType(this, html);
|
||||
}
|
||||
if (html !== "" && html != null) {
|
||||
htmltodom.appendHtmlToElement(html, this);
|
||||
}
|
||||
return html;
|
||||
});
|
||||
|
||||
|
||||
defineGetter(dom.Document.prototype, 'innerHTML', function() {
|
||||
return domToHtml(this._childNodes, true);
|
||||
});
|
||||
|
||||
defineSetter(dom.Document.prototype, 'innerHTML', function(html) {
|
||||
//Clear the children first:
|
||||
var child;
|
||||
while ((child = this._childNodes[0])) {
|
||||
this.removeChild(child);
|
||||
}
|
||||
|
||||
if (this.nodeName === '#document') {
|
||||
parseDocType(this, html);
|
||||
}
|
||||
if (html !== "" && html != null) {
|
||||
htmltodom.appendHtmlToElement(html, this);
|
||||
}
|
||||
return html;
|
||||
});
|
||||
|
||||
var DOC_HTML5 = /<!doctype html>/i,
|
||||
DOC_TYPE = /<!DOCTYPE (\w(.|\n)*)">/i,
|
||||
DOC_TYPE_START = '<!DOCTYPE ',
|
||||
DOC_TYPE_END = '">';
|
||||
|
||||
function parseDocType(doc, html) {
|
||||
var publicID = '',
|
||||
systemID = '',
|
||||
fullDT = '',
|
||||
name = 'HTML',
|
||||
set = true,
|
||||
doctype = html.match(DOC_HTML5);
|
||||
|
||||
//Default, No doctype === null
|
||||
doc._doctype = null;
|
||||
|
||||
if (doctype && doctype[0]) { //Handle the HTML shorty doctype
|
||||
fullDT = doctype[0];
|
||||
} else { //Parse the doctype
|
||||
// find the start
|
||||
var start = html.indexOf(DOC_TYPE_START),
|
||||
end = html.indexOf(DOC_TYPE_END),
|
||||
docString;
|
||||
|
||||
if (start < 0 || end < 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
docString = html.substr(start, (end-start)+DOC_TYPE_END.length);
|
||||
doctype = docString.replace(/[\n\r]/g,'').match(DOC_TYPE);
|
||||
|
||||
if (!doctype) {
|
||||
return;
|
||||
}
|
||||
|
||||
fullDT = doctype[0];
|
||||
doctype = doctype[1].split(' "');
|
||||
var _id1 = doctype.length ? doctype.pop().replace(/"/g, '') : '',
|
||||
_id2 = doctype.length ? doctype.pop().replace(/"/g, '') : '';
|
||||
|
||||
if (_id1.indexOf('-//') !== -1) {
|
||||
publicID = _id1;
|
||||
}
|
||||
if (_id2.indexOf('-//') !== -1) {
|
||||
publicID = _id2;
|
||||
}
|
||||
if (_id1.indexOf('://') !== -1) {
|
||||
systemID = _id1;
|
||||
}
|
||||
if (_id2.indexOf('://') !== -1) {
|
||||
systemID = _id2;
|
||||
}
|
||||
if (doctype.length) {
|
||||
doctype = doctype[0].split(' ');
|
||||
name = doctype[0].toUpperCase();
|
||||
}
|
||||
}
|
||||
doc._doctype = new dom.DOMImplementation().createDocumentType(name, publicID, systemID);
|
||||
doc._doctype._ownerDocument = doc;
|
||||
doc._doctype._fullDT = fullDT;
|
||||
doc._doctype.toString = function() {
|
||||
return this._fullDT;
|
||||
};
|
||||
}
|
||||
|
||||
dom.Document.prototype.getElementsByClassName = function(className) {
|
||||
|
||||
function filterByClassName(child) {
|
||||
if (!child) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (child.nodeType &&
|
||||
child.nodeType === dom.Node.ENTITY_REFERENCE_NODE)
|
||||
{
|
||||
child = child._entity;
|
||||
}
|
||||
|
||||
var classString = child.className;
|
||||
if (classString) {
|
||||
var s = classString.split(" ");
|
||||
for (var i=0; i<s.length; i++) {
|
||||
if (s[i] === className) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return new dom.NodeList(this.ownerDocument || this, dom.mapper(this, filterByClassName));
|
||||
};
|
||||
|
||||
defineGetter(dom.Element.prototype, 'nodeName', function(val) {
|
||||
return this._nodeName.toUpperCase();
|
||||
});
|
||||
|
||||
defineGetter(dom.Element.prototype, 'tagName', function(val) {
|
||||
var t = this._tagName.toUpperCase();
|
||||
//Document should not return a tagName
|
||||
if (this.nodeName === '#document') {
|
||||
t = null;
|
||||
}
|
||||
return t;
|
||||
});
|
||||
|
||||
dom.Element.prototype.scrollTop = 0;
|
||||
dom.Element.prototype.scrollLeft = 0;
|
||||
|
||||
defineGetter(dom.Document.prototype, 'parentWindow', function() {
|
||||
if (!this._parentWindow) {
|
||||
this.parentWindow = exports.windowAugmentation(dom, {document: this, url: this.URL});
|
||||
}
|
||||
return this._parentWindow;
|
||||
});
|
||||
|
||||
defineSetter(dom.Document.prototype, 'parentWindow', function(window) {
|
||||
// Contextify does not support getters and setters, so we have to set them
|
||||
// on the original object instead.
|
||||
window._frame = function (name, frame) {
|
||||
if (typeof frame === 'undefined') {
|
||||
delete window[name];
|
||||
} else {
|
||||
defineGetter(window, name, function () { return frame.contentWindow; });
|
||||
}
|
||||
};
|
||||
this._parentWindow = window.getGlobal();
|
||||
});
|
||||
|
||||
defineGetter(dom.Document.prototype, 'defaultView', function() {
|
||||
return this.parentWindow;
|
||||
});
|
||||
|
||||
dom._augmented = true;
|
||||
return dom;
|
||||
};
|
@ -1,99 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var URL = require("url");
|
||||
var NOT_IMPLEMENTED = require("./utils").NOT_IMPLEMENTED;
|
||||
|
||||
module.exports = Location;
|
||||
|
||||
function Location(urlString, window) {
|
||||
this._url = URL.parse(urlString);
|
||||
this._window = window;
|
||||
}
|
||||
|
||||
Location.prototype = {
|
||||
constructor: Location,
|
||||
reload: function () {
|
||||
NOT_IMPLEMENTED(this._window, "location.reload")();
|
||||
},
|
||||
get protocol() { return this._url.protocol || ":"; },
|
||||
get host() { return this._url.host || ""; },
|
||||
get auth() { return this._url.auth; },
|
||||
get hostname() { return this._url.hostname || ""; },
|
||||
get origin() { return ((this._url.protocol !== undefined && this._url.protocol !== null) ? this._url.protocol + "//" : this._url.protocol) + this._url.host || ""; },
|
||||
get port() { return this._url.port || ""; },
|
||||
get pathname() { return this._url.pathname || ""; },
|
||||
get href() { return this._url.href; },
|
||||
get hash() { return this._url.hash || ""; },
|
||||
get search() { return this._url.search || ""; },
|
||||
|
||||
set href(val) {
|
||||
var oldUrl = this._url.href;
|
||||
var oldProtocol = this._url.protocol;
|
||||
var oldHost = this._url.host;
|
||||
var oldPathname = this._url.pathname;
|
||||
var oldHash = this._url.hash || "";
|
||||
|
||||
this._url = URL.parse(URL.resolve(oldUrl, val));
|
||||
var newUrl = this._url.href;
|
||||
var newProtocol = this._url.protocol;
|
||||
var newHost = this._url.host;
|
||||
var newPathname = this._url.pathname;
|
||||
var newHash = this._url.hash || "";
|
||||
|
||||
if (oldProtocol === newProtocol && oldHost === newHost && oldPathname === newPathname && oldHash !== newHash) {
|
||||
this._signalHashChange(oldUrl, newUrl);
|
||||
} else {
|
||||
NOT_IMPLEMENTED(this._window, "location.href (no reload)")();
|
||||
}
|
||||
},
|
||||
|
||||
set hash(val) {
|
||||
var oldUrl = this._url.href;
|
||||
var oldHash = this._url.hash || "";
|
||||
|
||||
if (val.lastIndexOf("#", 0) !== 0) {
|
||||
val = "#" + val;
|
||||
}
|
||||
|
||||
this._url = URL.parse(URL.resolve(oldUrl, val));
|
||||
var newUrl = this._url.href;
|
||||
var newHash = this._url.hash || "";
|
||||
|
||||
if (oldHash !== newHash) {
|
||||
this._signalHashChange(oldUrl, newUrl);
|
||||
}
|
||||
},
|
||||
|
||||
set search(val) {
|
||||
var oldUrl = this._url.href;
|
||||
var oldHash = this._url.hash || "";
|
||||
if (val.length) {
|
||||
if (val.lastIndexOf("?", 0) !== 0) {
|
||||
val = "?" + val;
|
||||
}
|
||||
this._url = URL.parse(URL.resolve(oldUrl, val + oldHash));
|
||||
} else {
|
||||
this._url = URL.parse(oldUrl.replace(/\?([^#]+)/, ""));
|
||||
}
|
||||
},
|
||||
|
||||
replace: function (val) {
|
||||
this.href = val;
|
||||
},
|
||||
|
||||
toString: function () {
|
||||
return this._url.href;
|
||||
},
|
||||
|
||||
_signalHashChange: function (oldUrl, newUrl) {
|
||||
if (this._window.document) {
|
||||
var ev = this._window.document.createEvent("HTMLEvents");
|
||||
ev.initEvent("hashchange", false, false);
|
||||
ev.oldUrl = oldUrl;
|
||||
ev.newUrl = newUrl;
|
||||
process.nextTick(function () {
|
||||
this._window.dispatchEvent(ev);
|
||||
}.bind(this));
|
||||
}
|
||||
}
|
||||
};
|
@ -1,12 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var jsdom = require("../../jsdom");
|
||||
|
||||
exports.NOT_IMPLEMENTED = function (target, nameForErrorMessage) {
|
||||
return function () {
|
||||
if (!jsdom.debugMode) {
|
||||
var raise = target ? target.raise : this.raise;
|
||||
raise.call(this, "error", "NOT IMPLEMENTED" + (nameForErrorMessage ? ": " + nameForErrorMessage : ""));
|
||||
}
|
||||
};
|
||||
};
|
2065
bower_components/jsdom/lib/jsdom/level1/core.js
vendored
2065
bower_components/jsdom/lib/jsdom/level1/core.js
vendored
File diff suppressed because it is too large
Load Diff
628
bower_components/jsdom/lib/jsdom/level2/core.js
vendored
628
bower_components/jsdom/lib/jsdom/level2/core.js
vendored
@ -1,628 +0,0 @@
|
||||
var core = require("../level1/core").dom.level1.core;
|
||||
var defineGetter = require('../utils').defineGetter;
|
||||
var defineSetter = require('../utils').defineSetter;
|
||||
|
||||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325
|
||||
core = Object.create(core);
|
||||
|
||||
var INVALID_STATE_ERR = core.INVALID_STATE_ERR = 11,
|
||||
SYNTAX_ERR = core.SYNTAX_ERR = 12,
|
||||
INVALID_MODIFICATION_ERR = core.INVALID_MODIFICATION_ERR = 13,
|
||||
NAMESPACE_ERR = core.NAMESPACE_ERR = 14,
|
||||
INVALID_ACCESS_ERR = core.INVALID_ACCESS_ERR = 15,
|
||||
ns = {
|
||||
validate : function(ns, URI) {
|
||||
if (!ns) {
|
||||
throw new core.DOMException(core.INVALID_CHARACTER_ERR, "namespace is undefined");
|
||||
}
|
||||
|
||||
if(ns.match(/[^0-9a-z\.:\-_]/i) !== null) {
|
||||
throw new core.DOMException(core.INVALID_CHARACTER_ERR, ns);
|
||||
}
|
||||
|
||||
var msg = false, parts = ns.split(':');
|
||||
if (ns === 'xmlns' &&
|
||||
URI !== "http://www.w3.org/2000/xmlns/")
|
||||
{
|
||||
msg = "localName is 'xmlns' but the namespaceURI is invalid";
|
||||
|
||||
} else if (ns === "xml" &&
|
||||
URI !== "http://www.w3.org/XML/1998/namespace")
|
||||
{
|
||||
msg = "localName is 'xml' but the namespaceURI is invalid";
|
||||
|
||||
} else if (ns[ns.length-1] === ':') {
|
||||
msg = "Namespace seperator found with no localName";
|
||||
|
||||
} else if (ns[0] === ':') {
|
||||
msg = "Namespace seperator found, without a prefix";
|
||||
|
||||
} else if (parts.length > 2) {
|
||||
msg = "Too many namespace seperators";
|
||||
|
||||
}
|
||||
|
||||
if (msg) {
|
||||
throw new core.DOMException(NAMESPACE_ERR, msg + " (" + ns + "@" + URI + ")");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
core.exceptionMessages['NAMESPACE_ERR'] = "Invalid namespace";
|
||||
|
||||
core.DOMImplementation.prototype.createDocumentType = function(/* String */ qualifiedName,
|
||||
/* String */ publicId,
|
||||
/* String */ systemId)
|
||||
{
|
||||
ns.validate(qualifiedName);
|
||||
var doctype = new core.DocumentType(null, qualifiedName);
|
||||
doctype._publicId = publicId ? publicId : '';
|
||||
doctype._systemId = systemId ? systemId : '';
|
||||
return doctype;
|
||||
};
|
||||
|
||||
/**
|
||||
Creates an XML Document object of the specified type with its document element.
|
||||
HTML-only DOM implementations do not need to implement this method.
|
||||
*/
|
||||
core.DOMImplementation.prototype.createDocument = function(/* String */ namespaceURI,
|
||||
/* String */ qualifiedName,
|
||||
/* DocumentType */ doctype)
|
||||
{
|
||||
if (qualifiedName || namespaceURI) {
|
||||
ns.validate(qualifiedName, namespaceURI);
|
||||
}
|
||||
|
||||
if (doctype && doctype._ownerDocument !== null) {
|
||||
throw new core.DOMException(core.WRONG_DOCUMENT_ERR);
|
||||
}
|
||||
|
||||
if (qualifiedName && qualifiedName.indexOf(':') > -1 && !namespaceURI) {
|
||||
throw new core.DOMException(NAMESPACE_ERR);
|
||||
}
|
||||
|
||||
var document = new core.Document();
|
||||
|
||||
if (doctype) {
|
||||
document.doctype = doctype;
|
||||
doctype._ownerDocument = document;
|
||||
document.appendChild(doctype);
|
||||
} else {
|
||||
document.doctype = null;
|
||||
}
|
||||
|
||||
if (doctype && !doctype.entities) {
|
||||
doctype.entities = new core.EntityNodeMap();
|
||||
}
|
||||
|
||||
document._ownerDocument = document;
|
||||
|
||||
if (qualifiedName) {
|
||||
var docElement = document.createElementNS(namespaceURI, qualifiedName);
|
||||
document.appendChild(docElement);
|
||||
}
|
||||
|
||||
return document;
|
||||
};
|
||||
|
||||
defineGetter(core.Node.prototype, "ownerDocument", function() {
|
||||
return this._ownerDocument || null;
|
||||
});
|
||||
|
||||
core.Node.prototype.isSupported = function(/* string */ feature,
|
||||
/* string */ version)
|
||||
{
|
||||
return this._ownerDocument.implementation.hasFeature(feature, version);
|
||||
};
|
||||
|
||||
core.Node.prototype._namespaceURI = null;
|
||||
defineGetter(core.Node.prototype, "namespaceURI", function() {
|
||||
return this._namespaceURI || null;
|
||||
});
|
||||
|
||||
defineSetter(core.Node.prototype, "namespaceURI", function(value) {
|
||||
this._namespaceURI = value;
|
||||
});
|
||||
|
||||
defineGetter(core.Node.prototype, "prefix", function() {
|
||||
return this._prefix || null;
|
||||
});
|
||||
|
||||
defineSetter(core.Node.prototype, "prefix", function(value) {
|
||||
|
||||
if (this.readonly) {
|
||||
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
ns.validate(value, this._namespaceURI);
|
||||
|
||||
if ((this._created && !this._namespaceURI) ||
|
||||
this._prefix === "xmlns" ||
|
||||
(!this._prefix && this._created))
|
||||
{
|
||||
throw new core.DOMException(core.NAMESPACE_ERR);
|
||||
}
|
||||
|
||||
if (this._localName) {
|
||||
this._nodeName = value + ':' + this._localName;
|
||||
}
|
||||
|
||||
this._prefix = value;
|
||||
});
|
||||
|
||||
defineGetter(core.Node.prototype, "localName", function() {
|
||||
return this._localName || null;
|
||||
});
|
||||
|
||||
/* return boolean */
|
||||
core.Node.prototype.hasAttributes = function() {
|
||||
return (this.nodeType === this.ELEMENT_NODE &&
|
||||
this._attributes &&
|
||||
this._attributes.length > 0);
|
||||
};
|
||||
|
||||
core.NamedNodeMap.prototype.getNamedItemNS = function(/* string */ namespaceURI,
|
||||
/* string */ localName)
|
||||
{
|
||||
if (this._nsStore[namespaceURI] && this._nsStore[namespaceURI][localName]) {
|
||||
return this._nsStore[namespaceURI][localName];
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
core.NamedNodeMap.prototype.setNamedItemNS = function(/* Node */ arg)
|
||||
{
|
||||
if (this._readonly) {
|
||||
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
var owner = this._ownerDocument;
|
||||
if (this._parentNode &&
|
||||
this._parentNode._parentNode &&
|
||||
this._parentNode._parentNode.nodeType === owner.ENTITY_NODE)
|
||||
{
|
||||
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
if (this._ownerDocument !== arg.ownerDocument) {
|
||||
throw new core.DOMException(core.WRONG_DOCUMENT_ERR);
|
||||
}
|
||||
|
||||
if (arg._ownerElement) {
|
||||
throw new core.DOMException(core.INUSE_ATTRIBUTE_ERR);
|
||||
}
|
||||
|
||||
// readonly
|
||||
if (this._readonly === true) {
|
||||
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
|
||||
if (!this._nsStore[arg.namespaceURI]) {
|
||||
this._nsStore[arg.namespaceURI] = {};
|
||||
}
|
||||
var existing = null;
|
||||
if (this._nsStore[arg.namespaceURI][arg.localName]) {
|
||||
var existing = this._nsStore[arg.namespaceURI][arg.localName];
|
||||
}
|
||||
|
||||
this._nsStore[arg.namespaceURI][arg.localName] = arg;
|
||||
|
||||
arg._specified = true;
|
||||
arg._ownerDocument = this._ownerDocument;
|
||||
|
||||
return this.setNamedItem(arg);
|
||||
};
|
||||
|
||||
core.NamedNodeMap.prototype.removeNamedItemNS = function(/*string */ namespaceURI,
|
||||
/* string */ localName)
|
||||
{
|
||||
|
||||
if (this.readonly) {
|
||||
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
|
||||
var parent = this._parentNode,
|
||||
found = null,
|
||||
defaults,
|
||||
clone,
|
||||
defaultEl,
|
||||
defaultAttr;
|
||||
|
||||
if (this._parentNode &&
|
||||
this._parentNode._parentNode &&
|
||||
this._parentNode._parentNode.nodeType === this._ownerDocument.ENTITY_NODE)
|
||||
{
|
||||
throw new core.DOMException(core.NO_MODIFICATION_ALLOWED_ERR);
|
||||
}
|
||||
|
||||
if (this._nsStore[namespaceURI] &&
|
||||
this._nsStore[namespaceURI][localName])
|
||||
{
|
||||
found = this._nsStore[namespaceURI][localName];
|
||||
this.removeNamedItem(found.qualifiedName);
|
||||
delete this._nsStore[namespaceURI][localName];
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
throw new core.DOMException(core.NOT_FOUND_ERR);
|
||||
}
|
||||
|
||||
if (parent.ownerDocument.doctype && parent.ownerDocument.doctype._attributes) {
|
||||
defaults = parent.ownerDocument.doctype._attributes;
|
||||
defaultEl = defaults.getNamedItemNS(parent._namespaceURI, parent._localName);
|
||||
}
|
||||
|
||||
if (defaultEl) {
|
||||
defaultAttr = defaultEl._attributes.getNamedItemNS(namespaceURI, localName);
|
||||
|
||||
if (defaultAttr) {
|
||||
clone = defaultAttr.cloneNode(true);
|
||||
clone._created = false;
|
||||
clone._namespaceURI = found._namespaceURI;
|
||||
clone._nodeName = found.name;
|
||||
clone._localName = found._localName;
|
||||
clone._prefix = found._prefix
|
||||
this.setNamedItemNS(clone);
|
||||
clone._created = true;
|
||||
clone._specified = false;
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
};
|
||||
|
||||
defineGetter(core.Attr.prototype, "ownerElement", function() {
|
||||
return this._ownerElement || null;
|
||||
});
|
||||
|
||||
|
||||
core.Node.prototype._prefix = false;
|
||||
|
||||
defineSetter(core.Node.prototype, "qualifiedName", function(qualifiedName) {
|
||||
ns.validate(qualifiedName, this._namespaceURI);
|
||||
qualifiedName = qualifiedName || "";
|
||||
this._localName = qualifiedName.split(":")[1] || null;
|
||||
this.prefix = qualifiedName.split(":")[0] || null;
|
||||
this._nodeName = qualifiedName;
|
||||
});
|
||||
|
||||
defineGetter(core.Node.prototype, "qualifiedName", function() {
|
||||
return this._nodeName;
|
||||
});
|
||||
|
||||
core.NamedNodeMap.prototype._map = function(fn) {
|
||||
var ret = [], l = this.length, i = 0, node;
|
||||
for(i; i<l; i++) {
|
||||
node = this.item(i);
|
||||
if (fn && fn(node)) {
|
||||
ret.push(node);
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
};
|
||||
|
||||
core.Element.prototype.getAttribute = function(/* string */ name)
|
||||
{
|
||||
var attr = this.getAttributeNode(name);
|
||||
return attr && attr.value;
|
||||
};
|
||||
|
||||
core.Element.prototype.getAttributeNode = function(/* string */ name)
|
||||
{
|
||||
return this._attributes.$getNoNS(name);
|
||||
};
|
||||
|
||||
core.Element.prototype.removeAttribute = function(/* string */ name)
|
||||
{
|
||||
return this._attributes.$removeNoNS(name);
|
||||
};
|
||||
|
||||
core.Element.prototype.getAttributeNS = function(/* string */ namespaceURI,
|
||||
/* string */ localName)
|
||||
{
|
||||
if (namespaceURI === "") {
|
||||
namespaceURI = null;
|
||||
}
|
||||
|
||||
var attr = this._attributes.$getNode(namespaceURI, localName);
|
||||
return attr && attr.value;
|
||||
};
|
||||
|
||||
core.Element.prototype.setAttribute = function(/* string */ name,
|
||||
/* string */ value)
|
||||
{
|
||||
this._attributes.$setNoNS(name, value);
|
||||
};
|
||||
|
||||
core.Element.prototype.setAttributeNS = function(/* string */ namespaceURI,
|
||||
/* string */ qualifiedName,
|
||||
/* string */ value)
|
||||
{
|
||||
if (namespaceURI === "") {
|
||||
namespaceURI = null;
|
||||
}
|
||||
|
||||
var s = qualifiedName.split(':'),
|
||||
local = s.pop(),
|
||||
prefix = s.pop() || null,
|
||||
attr;
|
||||
|
||||
ns.validate(qualifiedName, namespaceURI);
|
||||
|
||||
if (prefix !== null && !namespaceURI) {
|
||||
throw new core.DOMException(core.NAMESPACE_ERR);
|
||||
}
|
||||
|
||||
if (prefix === "xml" &&
|
||||
namespaceURI !== "http://www.w3.org/XML/1998/namespace") {
|
||||
throw new core.DOMException(core.NAMESPACE_ERR);
|
||||
}
|
||||
|
||||
if (prefix === "xmlns" && namespaceURI !== "http://www.w3.org/2000/xmlns/") {
|
||||
throw new core.DOMException(core.NAMESPACE_ERR);
|
||||
}
|
||||
|
||||
this._attributes.$set(local, value, qualifiedName, prefix, namespaceURI);
|
||||
};
|
||||
|
||||
core.Element.prototype.removeAttributeNS = function(/* string */ namespaceURI,
|
||||
/* string */ localName)
|
||||
{
|
||||
if (namespaceURI === "") {
|
||||
namespaceURI = null;
|
||||
}
|
||||
|
||||
this._attributes.$remove(namespaceURI, localName);
|
||||
};
|
||||
|
||||
core.Element.prototype.getAttributeNodeNS = function(/* string */ namespaceURI,
|
||||
/* string */ localName)
|
||||
{
|
||||
if (namespaceURI === "") {
|
||||
namespaceURI = null;
|
||||
}
|
||||
|
||||
return this._attributes.$getNode(namespaceURI, localName);
|
||||
};
|
||||
core.Element.prototype._created = false;
|
||||
|
||||
core.Element.prototype.setAttributeNodeNS = function(/* Attr */ newAttr)
|
||||
{
|
||||
if (newAttr.ownerElement) {
|
||||
throw new core.DOMException(core.INUSE_ATTRIBUTE_ERR);
|
||||
}
|
||||
|
||||
return this._attributes.$setNode(newAttr);
|
||||
};
|
||||
|
||||
core.Element.prototype.getElementsByTagNameNS = function(/* String */ namespaceURI,
|
||||
/* String */ localName)
|
||||
{
|
||||
var nsPrefixCache = {};
|
||||
|
||||
function filterByTagName(child) {
|
||||
if (child.nodeType && child.nodeType === this.ENTITY_REFERENCE_NODE) {
|
||||
child = child._entity;
|
||||
}
|
||||
|
||||
var localMatch = child.localName === localName,
|
||||
nsMatch = child.namespaceURI === namespaceURI;
|
||||
|
||||
if ((localMatch || localName === "*") &&
|
||||
(nsMatch || namespaceURI === "*"))
|
||||
{
|
||||
if (child.nodeType === child.ELEMENT_NODE) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return new core.NodeList(this.ownerDocument || this,
|
||||
core.mapper(this, filterByTagName));
|
||||
};
|
||||
|
||||
core.Element.prototype.hasAttribute = function(/* string */name)
|
||||
{
|
||||
if (!this._attributes) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!this._attributes.$getNoNS(name);
|
||||
};
|
||||
|
||||
core.Element.prototype.hasAttributeNS = function(/* string */namespaceURI,
|
||||
/* string */localName)
|
||||
{
|
||||
if (namespaceURI === "") {
|
||||
namespaceURI = null;
|
||||
}
|
||||
|
||||
return (this._attributes.getNamedItemNS(namespaceURI, localName) ||
|
||||
this.hasAttribute(localName));
|
||||
};
|
||||
|
||||
defineGetter(core.DocumentType.prototype, "publicId", function() {
|
||||
return this._publicId || "";
|
||||
});
|
||||
|
||||
defineGetter(core.DocumentType.prototype, "systemId", function() {
|
||||
return this._systemId || "";
|
||||
});
|
||||
|
||||
defineGetter(core.DocumentType.prototype, "internalSubset", function() {
|
||||
return this._internalSubset || null;
|
||||
});
|
||||
|
||||
core.Document.prototype.importNode = function(/* Node */ importedNode,
|
||||
/* bool */ deep)
|
||||
{
|
||||
if (importedNode && importedNode.nodeType) {
|
||||
if (importedNode.nodeType === this.DOCUMENT_NODE ||
|
||||
importedNode.nodeType === this.DOCUMENT_TYPE_NODE) {
|
||||
throw new core.DOMException(core.NOT_SUPPORTED_ERR);
|
||||
}
|
||||
}
|
||||
|
||||
var self = this,
|
||||
newNode = importedNode.cloneNode(deep, function(a, b) {
|
||||
b._namespaceURI = a._namespaceURI;
|
||||
b._nodeName = a._nodeName;
|
||||
b._localName = a._localName;
|
||||
}),
|
||||
defaults = false,
|
||||
defaultEl;
|
||||
|
||||
if (this.doctype && this.doctype._attributes) {
|
||||
defaults = this.doctype._attributes;
|
||||
}
|
||||
|
||||
function lastChance(el) {
|
||||
var attr, defaultEl, i, len;
|
||||
|
||||
el._ownerDocument = self;
|
||||
if (el.id) {
|
||||
if (!self._ids) {self._ids = {};}
|
||||
if (!self._ids[el.id]) {self._ids[el.id] = [];}
|
||||
self._ids[el.id].push(el);
|
||||
}
|
||||
if (el._attributes) {
|
||||
var drop = [];
|
||||
el._attributes._ownerDocument = self;
|
||||
for (i=0,len=el._attributes.length; i < len; i++) {
|
||||
attr = el._attributes[i];
|
||||
// Attributes nodes that were expressing default values in the
|
||||
// original document must not be copied over. Record them.
|
||||
if (!attr._specified) {
|
||||
drop.push(attr);
|
||||
continue;
|
||||
}
|
||||
|
||||
attr._ownerDocument = self;
|
||||
}
|
||||
|
||||
// Remove obsolete default nodes.
|
||||
for(i = 0; i < drop.length; ++i) {
|
||||
el._attributes.$removeNode(drop[i]);
|
||||
}
|
||||
|
||||
}
|
||||
if (defaults) {
|
||||
|
||||
defaultEl = defaults.getNamedItemNS(el._namespaceURI,
|
||||
el._localName);
|
||||
|
||||
// TODO: This could use some love
|
||||
if (defaultEl) {
|
||||
for(i = 0; i < defaultEl._attributes.length; ++i) {
|
||||
var defaultAttr = defaultEl._attributes[i];
|
||||
if (!el.hasAttributeNS(defaultAttr.namespaceURL,
|
||||
defaultAttr.localName))
|
||||
{
|
||||
var clone = defaultAttr.cloneNode(true);
|
||||
clone._namespaceURI = defaultAttr._namespaceURI;
|
||||
clone._prefix = defaultAttr._prefix;
|
||||
clone._localName = defaultAttr._localName;
|
||||
el.setAttributeNodeNS(clone);
|
||||
clone._specified = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (deep) {
|
||||
core.visitTree(newNode, lastChance);
|
||||
}
|
||||
else {
|
||||
lastChance(newNode);
|
||||
}
|
||||
|
||||
if (newNode.nodeType == newNode.ATTRIBUTE_NODE) {
|
||||
newNode._specified = true;
|
||||
}
|
||||
|
||||
return newNode;
|
||||
};
|
||||
|
||||
core.Document.prototype.createElementNS = function(/* string */ namespaceURI,
|
||||
/* string */ qualifiedName)
|
||||
{
|
||||
var parts = qualifiedName.split(':'),
|
||||
element, prefix;
|
||||
|
||||
if (parts.length > 1 && !namespaceURI) {
|
||||
throw new core.DOMException(core.NAMESPACE_ERR);
|
||||
}
|
||||
|
||||
ns.validate(qualifiedName, namespaceURI);
|
||||
element = this.createElement(qualifiedName),
|
||||
|
||||
element._created = false;
|
||||
|
||||
element._namespaceURI = namespaceURI;
|
||||
element._nodeName = qualifiedName;
|
||||
element._localName = parts.pop();
|
||||
|
||||
if (parts.length > 0) {
|
||||
prefix = parts.pop();
|
||||
element.prefix = prefix;
|
||||
}
|
||||
|
||||
element._created = true;
|
||||
return element;
|
||||
};
|
||||
|
||||
core.Document.prototype.createAttributeNS = function(/* string */ namespaceURI,
|
||||
/* string */ qualifiedName)
|
||||
{
|
||||
var attribute, parts = qualifiedName.split(':');
|
||||
|
||||
if (parts.length > 1 && !namespaceURI) {
|
||||
throw new core.DOMException(core.NAMESPACE_ERR,
|
||||
"Prefix specified without namespaceURI (" + qualifiedName + ")");
|
||||
}
|
||||
|
||||
|
||||
ns.validate(qualifiedName, namespaceURI);
|
||||
|
||||
attribute = this.createAttribute(qualifiedName);
|
||||
attribute.namespaceURI = namespaceURI;
|
||||
attribute.qualifiedName = qualifiedName;
|
||||
|
||||
attribute._localName = parts.pop();
|
||||
attribute._prefix = (parts.length > 0) ? parts.pop() : null;
|
||||
return attribute;
|
||||
};
|
||||
|
||||
core.Document.prototype.getElementsByTagNameNS = function(/* String */ namespaceURI,
|
||||
/* String */ localName)
|
||||
{
|
||||
return core.Element.prototype.getElementsByTagNameNS.call(this,
|
||||
namespaceURI,
|
||||
localName);
|
||||
};
|
||||
|
||||
defineSetter(core.Element.prototype, "id", function(id) {
|
||||
this.setAttribute("id", id);
|
||||
});
|
||||
|
||||
defineGetter(core.Element.prototype, "id", function() {
|
||||
return this.getAttribute("id");
|
||||
});
|
||||
|
||||
core.Document.prototype.getElementById = function(id) {
|
||||
// return the first element
|
||||
return (this._ids && this._ids[id] && this._ids[id].length > 0 ? this._ids[id][0] : null);
|
||||
};
|
||||
|
||||
|
||||
exports.dom =
|
||||
{
|
||||
level2 : {
|
||||
core : core
|
||||
}
|
||||
};
|
468
bower_components/jsdom/lib/jsdom/level2/events.js
vendored
468
bower_components/jsdom/lib/jsdom/level2/events.js
vendored
@ -1,468 +0,0 @@
|
||||
/* DOM Level2 Events implemented as described here:
|
||||
*
|
||||
* http://www.w3.org/TR/2000/REC-DOM-Level-2-Events-20001113/events.html
|
||||
*
|
||||
*/
|
||||
var core = require("./core").dom.level2.core,
|
||||
utils = require("../utils"),
|
||||
defineGetter = utils.defineGetter,
|
||||
defineSetter = utils.defineSetter,
|
||||
inheritFrom = utils.inheritFrom;
|
||||
|
||||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325
|
||||
core = Object.create(core);
|
||||
|
||||
var events = {};
|
||||
|
||||
events.EventException = function() {
|
||||
if (arguments.length > 0) {
|
||||
this._code = arguments[0];
|
||||
} else {
|
||||
this._code = 0;
|
||||
}
|
||||
if (arguments.length > 1) {
|
||||
this._message = arguments[1];
|
||||
} else {
|
||||
this._message = "Unspecified event type";
|
||||
}
|
||||
Error.call(this, this._message);
|
||||
if (Error.captureStackTrace) {
|
||||
Error.captureStackTrace(this, events.EventException);
|
||||
}
|
||||
};
|
||||
inheritFrom(Error, events.EventException, {
|
||||
UNSPECIFIED_EVENT_TYPE_ERR : 0,
|
||||
get code() { return this._code;}
|
||||
});
|
||||
|
||||
events.Event = function(eventType) {
|
||||
this._eventType = eventType;
|
||||
this._type = null;
|
||||
this._bubbles = null;
|
||||
this._cancelable = null;
|
||||
this._target = null;
|
||||
this._currentTarget = null;
|
||||
this._eventPhase = null;
|
||||
this._timeStamp = null;
|
||||
this._preventDefault = false;
|
||||
this._stopPropagation = false;
|
||||
};
|
||||
events.Event.prototype = {
|
||||
initEvent: function(type, bubbles, cancelable) {
|
||||
this._type = type;
|
||||
this._bubbles = bubbles;
|
||||
this._cancelable = cancelable;
|
||||
},
|
||||
preventDefault: function() {
|
||||
if (this._cancelable) {
|
||||
this._preventDefault = true;
|
||||
}
|
||||
},
|
||||
stopPropagation: function() {
|
||||
this._stopPropagation = true;
|
||||
},
|
||||
CAPTURING_PHASE : 1,
|
||||
AT_TARGET : 2,
|
||||
BUBBLING_PHASE : 3,
|
||||
get eventType() { return this._eventType; },
|
||||
get type() { return this._type; },
|
||||
get bubbles() { return this._bubbles; },
|
||||
get cancelable() { return this._cancelable; },
|
||||
get target() { return this._target; },
|
||||
get currentTarget() { return this._currentTarget; },
|
||||
get eventPhase() { return this._eventPhase; },
|
||||
get timeStamp() { return this._timeStamp; }
|
||||
};
|
||||
|
||||
|
||||
events.UIEvent = function(eventType) {
|
||||
events.Event.call(this, eventType);
|
||||
this.view = null;
|
||||
this.detail = null;
|
||||
};
|
||||
inheritFrom(events.Event, events.UIEvent, {
|
||||
initUIEvent: function(type, bubbles, cancelable, view, detail) {
|
||||
this.initEvent(type, bubbles, cancelable);
|
||||
this.view = view;
|
||||
this.detail = detail;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
events.MouseEvent = function(eventType) {
|
||||
events.UIEvent.call(this, eventType);
|
||||
this.screenX = null;
|
||||
this.screenY = null;
|
||||
this.clientX = null;
|
||||
this.clientY = null;
|
||||
this.ctrlKey = null;
|
||||
this.shiftKey = null;
|
||||
this.altKey = null;
|
||||
this.metaKey = null;
|
||||
this.button = null;
|
||||
this.relatedTarget = null;
|
||||
};
|
||||
inheritFrom(events.UIEvent, events.MouseEvent, {
|
||||
initMouseEvent: function(type,
|
||||
bubbles,
|
||||
cancelable,
|
||||
view,
|
||||
detail,
|
||||
screenX,
|
||||
screenY,
|
||||
clientX,
|
||||
clientY,
|
||||
ctrlKey,
|
||||
altKey,
|
||||
shiftKey,
|
||||
metaKey,
|
||||
button,
|
||||
relatedTarget) {
|
||||
this.initUIEvent(type, bubbles, cancelable, view, detail);
|
||||
this.screenX = screenX
|
||||
this.screenY = screenY
|
||||
this.clientX = clientX
|
||||
this.clientY = clientY
|
||||
this.ctrlKey = ctrlKey
|
||||
this.shiftKey = shiftKey
|
||||
this.altKey = altKey
|
||||
this.metaKey = metaKey
|
||||
this.button = button
|
||||
this.relatedTarget = relatedTarget
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
events.MutationEvent = function(eventType) {
|
||||
events.Event.call(this, eventType);
|
||||
this.relatedNode = null;
|
||||
this.prevValue = null;
|
||||
this.newValue = null;
|
||||
this.attrName = null;
|
||||
this.attrChange = null;
|
||||
};
|
||||
inheritFrom(events.Event, events.MutationEvent, {
|
||||
initMutationEvent: function(type,
|
||||
bubbles,
|
||||
cancelable,
|
||||
relatedNode,
|
||||
prevValue,
|
||||
newValue,
|
||||
attrName,
|
||||
attrChange) {
|
||||
this.initEvent(type, bubbles, cancelable);
|
||||
this.relatedNode = relatedNode;
|
||||
this.prevValue = prevValue;
|
||||
this.newValue = newValue;
|
||||
this.attrName = attrName;
|
||||
this.attrChange = attrChange;
|
||||
},
|
||||
MODIFICATION : 1,
|
||||
ADDITION : 2,
|
||||
REMOVAL : 3
|
||||
});
|
||||
|
||||
events.EventTarget = function() {};
|
||||
|
||||
events.EventTarget.getListeners = function getListeners(target, type, capturing) {
|
||||
var listeners = target._listeners
|
||||
&& target._listeners[type]
|
||||
&& target._listeners[type][capturing] || [];
|
||||
if (!capturing) {
|
||||
var traditionalHandler = target['on' + type];
|
||||
if (traditionalHandler) {
|
||||
var implementation = (target._ownerDocument ? target._ownerDocument.implementation
|
||||
: target.document.implementation);
|
||||
|
||||
if (implementation.hasFeature('ProcessExternalResources', 'script')) {
|
||||
listeners.push(traditionalHandler);
|
||||
}
|
||||
}
|
||||
}
|
||||
return listeners;
|
||||
};
|
||||
|
||||
events.EventTarget.dispatch = function dispatch(event, iterator, capturing) {
|
||||
var listeners,
|
||||
currentListener,
|
||||
target = iterator();
|
||||
|
||||
while (target && !event._stopPropagation) {
|
||||
listeners = events.EventTarget.getListeners(target, event._type, capturing);
|
||||
currentListener = listeners.length;
|
||||
while (currentListener--) {
|
||||
event._currentTarget = target;
|
||||
try {
|
||||
listeners[currentListener].call(target, event);
|
||||
} catch (e) {
|
||||
target.raise(
|
||||
'error', "Dispatching event '" + event._type + "' failed",
|
||||
{error: e, event: event}
|
||||
);
|
||||
}
|
||||
}
|
||||
target = iterator();
|
||||
}
|
||||
return !event._stopPropagation;
|
||||
};
|
||||
|
||||
events.EventTarget.forwardIterator = function forwardIterator(list) {
|
||||
var i = 0, len = list.length;
|
||||
return function iterator() { return i < len ? list[i++] : null };
|
||||
};
|
||||
|
||||
events.EventTarget.backwardIterator = function backwardIterator(list) {
|
||||
var i = list.length;
|
||||
return function iterator() { return i >=0 ? list[--i] : null };
|
||||
};
|
||||
|
||||
events.EventTarget.singleIterator = function singleIterator(obj) {
|
||||
var i = 1;
|
||||
return function iterator() { return i-- ? obj : null };
|
||||
};
|
||||
|
||||
events.EventTarget.prototype = {
|
||||
addEventListener: function(type, listener, capturing) {
|
||||
this._listeners = this._listeners || {};
|
||||
var listeners = this._listeners[type] || {};
|
||||
capturing = (capturing === true);
|
||||
var capturingListeners = listeners[capturing] || [];
|
||||
for (var i=0; i < capturingListeners.length; i++) {
|
||||
if (capturingListeners[i] === listener) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
capturingListeners.push(listener);
|
||||
listeners[capturing] = capturingListeners;
|
||||
this._listeners[type] = listeners;
|
||||
},
|
||||
|
||||
removeEventListener: function(type, listener, capturing) {
|
||||
var listeners = this._listeners && this._listeners[type];
|
||||
if (!listeners) return;
|
||||
var capturingListeners = listeners[(capturing === true)];
|
||||
if (!capturingListeners) return;
|
||||
for (var i=0; i < capturingListeners.length; i++) {
|
||||
if (capturingListeners[i] === listener) {
|
||||
capturingListeners.splice(i, 1);
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
dispatchEvent: function(event) {
|
||||
if (event == null) {
|
||||
throw new events.EventException(0, "Null event");
|
||||
}
|
||||
if (event._type == null || event._type == "") {
|
||||
throw new events.EventException(0, "Uninitialized event");
|
||||
}
|
||||
|
||||
var targetList = [];
|
||||
|
||||
event._target = this;
|
||||
|
||||
//per the spec we gather the list of targets first to ensure
|
||||
//against dom modifications during actual event dispatch
|
||||
var target = this,
|
||||
targetParent = target._parentNode;
|
||||
while (targetParent) {
|
||||
targetList.push(targetParent);
|
||||
target = targetParent;
|
||||
targetParent = target._parentNode;
|
||||
}
|
||||
targetParent = target._parentWindow;
|
||||
if (targetParent) {
|
||||
targetList.push(targetParent);
|
||||
}
|
||||
|
||||
var iterator = events.EventTarget.backwardIterator(targetList);
|
||||
|
||||
event._eventPhase = event.CAPTURING_PHASE;
|
||||
if (!events.EventTarget.dispatch(event, iterator, true)) return event._preventDefault;
|
||||
|
||||
iterator = events.EventTarget.singleIterator(event._target);
|
||||
event._eventPhase = event.AT_TARGET;
|
||||
if (!events.EventTarget.dispatch(event, iterator, false)) return event._preventDefault;
|
||||
|
||||
if (event._bubbles && !event._stopPropagation) {
|
||||
var i = 0;
|
||||
iterator = events.EventTarget.forwardIterator(targetList);
|
||||
event._eventPhase = event.BUBBLING_PHASE;
|
||||
events.EventTarget.dispatch(event, iterator, false);
|
||||
}
|
||||
|
||||
return event._preventDefault;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
// Reinherit class heirarchy with EventTarget at its root
|
||||
inheritFrom(events.EventTarget, core.Node, core.Node.prototype);
|
||||
|
||||
// Node
|
||||
inheritFrom(core.Node, core.Attr, core.Attr.prototype);
|
||||
inheritFrom(core.Node, core.CharacterData, core.CharacterData.prototype);
|
||||
inheritFrom(core.Node, core.Document, core.Document.prototype);
|
||||
inheritFrom(core.Node, core.DocumentFragment, core.DocumentFragment.prototype);
|
||||
inheritFrom(core.Node, core.DocumentType, core.DocumentType.prototype);
|
||||
inheritFrom(core.Node, core.Element, core.Element.prototype);
|
||||
inheritFrom(core.Node, core.Entity, core.Entity.prototype);
|
||||
inheritFrom(core.Node, core.EntityReference, core.EntityReference.prototype);
|
||||
inheritFrom(core.Node, core.Notation, core.Notation.prototype);
|
||||
inheritFrom(core.Node, core.ProcessingInstruction, core.ProcessingInstruction.prototype);
|
||||
|
||||
// CharacterData
|
||||
inheritFrom(core.CharacterData, core.Text, core.Text.prototype);
|
||||
|
||||
// Text
|
||||
inheritFrom(core.Text, core.CDATASection, core.CDATASection.prototype);
|
||||
inheritFrom(core.Text, core.Comment, core.Comment.prototype);
|
||||
|
||||
function getDocument(el) {
|
||||
return el.nodeType == core.Node.DOCUMENT_NODE ? el : el._ownerDocument;
|
||||
}
|
||||
|
||||
function mutationEventsEnabled(el) {
|
||||
return el.nodeType != core.Node.ATTRIBUTE_NODE &&
|
||||
getDocument(el).implementation.hasFeature('MutationEvents');
|
||||
}
|
||||
|
||||
utils.intercept(core.Node, 'insertBefore', function(_super, args, newChild, refChild) {
|
||||
var ret = _super.apply(this, args);
|
||||
if (mutationEventsEnabled(this)) {
|
||||
var doc = getDocument(this),
|
||||
ev = doc.createEvent("MutationEvents");
|
||||
|
||||
ev.initMutationEvent("DOMNodeInserted", true, false, this, null, null, null, null);
|
||||
newChild.dispatchEvent(ev);
|
||||
if (this.nodeType == core.Node.DOCUMENT_NODE || this._attachedToDocument) {
|
||||
ev = doc.createEvent("MutationEvents");
|
||||
ev.initMutationEvent("DOMNodeInsertedIntoDocument", false, false, null, null, null, null, null);
|
||||
core.visitTree(newChild, function(el) {
|
||||
if (el.nodeType == core.Node.ELEMENT_NODE) {
|
||||
el.dispatchEvent(ev);
|
||||
el._attachedToDocument = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
});
|
||||
|
||||
utils.intercept(core.Node, 'removeChild', function (_super, args, oldChild) {
|
||||
if (mutationEventsEnabled(this)) {
|
||||
var doc = getDocument(this),
|
||||
ev = doc.createEvent("MutationEvents");
|
||||
|
||||
ev.initMutationEvent("DOMNodeRemoved", true, false, this, null, null, null, null);
|
||||
oldChild.dispatchEvent(ev);
|
||||
|
||||
ev = doc.createEvent("MutationEvents");
|
||||
ev.initMutationEvent("DOMNodeRemovedFromDocument", false, false, null, null, null, null, null);
|
||||
core.visitTree(oldChild, function(el) {
|
||||
if (el.nodeType == core.Node.ELEMENT_NODE) {
|
||||
el.dispatchEvent(ev);
|
||||
el._attachedToDocument = false;
|
||||
}
|
||||
});
|
||||
}
|
||||
return _super.apply(this, args);
|
||||
});
|
||||
|
||||
function dispatchAttrEvent(doc, target, prevVal, newVal, attrName, attrChange) {
|
||||
if (!newVal || newVal != prevVal) {
|
||||
var ev = doc.createEvent("MutationEvents");
|
||||
ev.initMutationEvent("DOMAttrModified", true, false, target, prevVal,
|
||||
newVal, attrName, attrChange);
|
||||
target.dispatchEvent(ev);
|
||||
}
|
||||
}
|
||||
|
||||
function attrNodeInterceptor(change) {
|
||||
return function(_super, args, node) {
|
||||
var target = this._parentNode,
|
||||
prev = _super.apply(this, args);
|
||||
|
||||
if (mutationEventsEnabled(target)) {
|
||||
dispatchAttrEvent(target._ownerDocument,
|
||||
target,
|
||||
prev && prev.value || null,
|
||||
change == 'ADDITION' ? node.value : null,
|
||||
prev && prev.name || node.name,
|
||||
events.MutationEvent.prototype[change]);
|
||||
}
|
||||
|
||||
return prev;
|
||||
};
|
||||
}
|
||||
|
||||
function attrInterceptor(ns) {
|
||||
return function(_super, args, localName, value, _name, _prefix, namespace) {
|
||||
var target = this._parentNode;
|
||||
|
||||
if (!mutationEventsEnabled(target)) {
|
||||
_super.apply(this, args);
|
||||
return;
|
||||
}
|
||||
|
||||
if (namespace === undefined) {
|
||||
namespace = null;
|
||||
}
|
||||
|
||||
var prev =
|
||||
ns ? this.$getNode(namespace, localName) : this.$getNoNS(localName);
|
||||
var prevVal = prev && prev.value || null;
|
||||
|
||||
_super.apply(this, args);
|
||||
|
||||
var node = ns ? this.$getNode(namespace, localName):
|
||||
this.$getNoNS(localName);
|
||||
|
||||
dispatchAttrEvent(target._ownerDocument,
|
||||
target,
|
||||
prevVal,
|
||||
node.value,
|
||||
node.name,
|
||||
events.MutationEvent.prototype.ADDITION);
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
utils.intercept(core.AttributeList, '$removeNode',
|
||||
attrNodeInterceptor('REMOVAL'));
|
||||
utils.intercept(core.AttributeList, '$setNode',
|
||||
attrNodeInterceptor('ADDITION'));
|
||||
utils.intercept(core.AttributeList, '$set', attrInterceptor(true));
|
||||
utils.intercept(core.AttributeList, '$setNoNS', attrInterceptor(false));
|
||||
|
||||
defineGetter(core.CharacterData.prototype, "_nodeValue", function() {
|
||||
return this.__nodeValue;
|
||||
});
|
||||
defineSetter(core.CharacterData.prototype, "_nodeValue", function(value) {
|
||||
var oldValue = this.__nodeValue;
|
||||
this.__nodeValue = value;
|
||||
if (this._ownerDocument && this._parentNode && mutationEventsEnabled(this)) {
|
||||
var ev = this._ownerDocument.createEvent("MutationEvents")
|
||||
ev.initMutationEvent("DOMCharacterDataModified", true, false, this, oldValue, value, null, null);
|
||||
this.dispatchEvent(ev);
|
||||
}
|
||||
});
|
||||
|
||||
core.Document.prototype.createEvent = function(eventType) {
|
||||
switch (eventType) {
|
||||
case "MutationEvents": return new events.MutationEvent(eventType);
|
||||
case "UIEvents": return new events.UIEvent(eventType);
|
||||
case "MouseEvents": return new events.MouseEvent(eventType);
|
||||
case "HTMLEvents": return new events.Event(eventType);
|
||||
}
|
||||
return new events.Event(eventType);
|
||||
};
|
||||
|
||||
exports.dom =
|
||||
{
|
||||
level2 : {
|
||||
core : core,
|
||||
events : events
|
||||
}
|
||||
};
|
2038
bower_components/jsdom/lib/jsdom/level2/html.js
vendored
2038
bower_components/jsdom/lib/jsdom/level2/html.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,7 +0,0 @@
|
||||
exports.dom = {
|
||||
level2 : {
|
||||
core : require("./core").dom.level2.core,
|
||||
events : require("./events").dom.level2.events,
|
||||
html : require("./html").dom.level2.html
|
||||
}
|
||||
};
|
@ -1,13 +0,0 @@
|
||||
exports.javascript = function(element, code, filename) {
|
||||
var doc = element.ownerDocument, window = doc && doc.parentWindow;
|
||||
if (window) {
|
||||
try {
|
||||
window.run(code, filename);
|
||||
} catch (e) {
|
||||
element.raise(
|
||||
'error', 'Running ' + filename + ' failed.',
|
||||
{error: e, filename: filename}
|
||||
);
|
||||
}
|
||||
}
|
||||
};
|
270
bower_components/jsdom/lib/jsdom/level2/style.js
vendored
270
bower_components/jsdom/lib/jsdom/level2/style.js
vendored
@ -1,270 +0,0 @@
|
||||
var core = require("./core").dom.level2.core,
|
||||
html = require("./html").dom.level2.html,
|
||||
utils = require("../utils"),
|
||||
defineGetter = utils.defineGetter,
|
||||
defineSetter = utils.defineSetter,
|
||||
inheritFrom = utils.inheritFrom,
|
||||
cssom = require("cssom"),
|
||||
cssstyle = require("cssstyle"),
|
||||
assert = require('assert');
|
||||
|
||||
// What works now:
|
||||
// - Accessing the rules defined in individual stylesheets
|
||||
// - Modifications to style content attribute are reflected in style property
|
||||
// - Modifications to style property are reflected in style content attribute
|
||||
// TODO
|
||||
// - Modifications to style element's textContent are reflected in sheet property.
|
||||
// - Modifications to style element's sheet property are reflected in textContent.
|
||||
// - Modifications to link.href property are reflected in sheet property.
|
||||
// - Less-used features of link: disabled
|
||||
// - Less-used features of style: disabled, scoped, title
|
||||
// - CSSOM-View
|
||||
// - getComputedStyle(): requires default stylesheet, cascading, inheritance,
|
||||
// filtering by @media (screen? print?), layout for widths/heights
|
||||
// - Load events are not in the specs, but apparently some browsers
|
||||
// implement something. Should onload only fire after all @imports have been
|
||||
// loaded, or only the primary sheet?
|
||||
|
||||
core.StyleSheet = cssom.StyleSheet;
|
||||
core.MediaList = cssom.MediaList;
|
||||
core.CSSStyleSheet = cssom.CSSStyleSheet;
|
||||
core.CSSRule = cssom.CSSRule;
|
||||
core.CSSStyleRule = cssom.CSSStyleRule;
|
||||
core.CSSMediaRule = cssom.CSSMediaRule;
|
||||
core.CSSImportRule = cssom.CSSImportRule;
|
||||
core.CSSStyleDeclaration = cssstyle.CSSStyleDeclaration;
|
||||
|
||||
// Relavant specs
|
||||
// http://www.w3.org/TR/DOM-Level-2-Style (2000)
|
||||
// http://www.w3.org/TR/cssom-view/ (2008)
|
||||
// http://dev.w3.org/csswg/cssom/ (2010) Meant to replace DOM Level 2 Style
|
||||
// http://www.whatwg.org/specs/web-apps/current-work/multipage/ HTML5, of course
|
||||
// http://dev.w3.org/csswg/css-style-attr/ not sure what's new here
|
||||
|
||||
// Objects that aren't in cssom library but should be:
|
||||
// CSSRuleList (cssom just uses array)
|
||||
// CSSFontFaceRule
|
||||
// CSSPageRule
|
||||
|
||||
// These rules don't really make sense to implement, so CSSOM draft makes them
|
||||
// obsolete.
|
||||
// CSSCharsetRule
|
||||
// CSSUnknownRule
|
||||
|
||||
// These objects are considered obsolete by CSSOM draft, although modern
|
||||
// browsers implement them.
|
||||
// CSSValue
|
||||
// CSSPrimitiveValue
|
||||
// CSSValueList
|
||||
// RGBColor
|
||||
// Rect
|
||||
// Counter
|
||||
|
||||
// StyleSheetList -
|
||||
// http://www.w3.org/TR/DOM-Level-2-Style/stylesheets.html#StyleSheets-StyleSheetList
|
||||
// added a push method to help manage the length
|
||||
core.StyleSheetList = function() {
|
||||
this._length = 0;
|
||||
};
|
||||
core.StyleSheetList.prototype = {
|
||||
item: function (i) {
|
||||
return this[i];
|
||||
},
|
||||
push: function (sheet) {
|
||||
this[this._length] = sheet;
|
||||
this._length++;
|
||||
},
|
||||
get length() {
|
||||
return this._length;
|
||||
}
|
||||
};
|
||||
|
||||
defineGetter(core.Document.prototype, 'styleSheets', function() {
|
||||
if (!this._styleSheets) {
|
||||
this._styleSheets = new core.StyleSheetList();
|
||||
}
|
||||
// TODO: each style and link element should register its sheet on creation
|
||||
// and remove it on removal.
|
||||
return this._styleSheets;
|
||||
});
|
||||
|
||||
|
||||
/**
|
||||
* @this {html.HTMLLinkElement|html.HTMLStyleElement}
|
||||
* @param {string} url
|
||||
* @param {cssom.CSSStyleSheet} sheet
|
||||
* @see http://dev.w3.org/csswg/cssom/#requirements-on-user-agents-implementing0
|
||||
*/
|
||||
function fetchStylesheet(url, sheet) {
|
||||
html.resourceLoader.load(this, url, function(data, filename) {
|
||||
// TODO: abort if the content-type is not text/css, and the document is
|
||||
// in strict mode
|
||||
sheet.href = html.resourceLoader.resolve(this.ownerDocument, url);
|
||||
evaluateStylesheet.call(this, data, sheet, url);
|
||||
});
|
||||
}
|
||||
/**
|
||||
* @this {html.HTMLLinkElement|html.HTMLStyleElement}
|
||||
* @param {string} data
|
||||
* @param {cssom.CSSStyleSheet} sheet
|
||||
* @param {string} baseUrl
|
||||
*/
|
||||
function evaluateStylesheet(data, sheet, baseUrl) {
|
||||
// this is the element
|
||||
var newStyleSheet = cssom.parse(data);
|
||||
var spliceArgs = newStyleSheet.cssRules;
|
||||
spliceArgs.unshift(0, sheet.cssRules.length);
|
||||
Array.prototype.splice.apply(sheet.cssRules, spliceArgs);
|
||||
scanForImportRules.call(this, sheet.cssRules, baseUrl);
|
||||
this.ownerDocument.styleSheets.push(sheet);
|
||||
}
|
||||
/**
|
||||
* @this {html.HTMLLinkElement|html.HTMLStyleElement}
|
||||
* @param {cssom.CSSStyleSheet} sheet
|
||||
* @param {string} baseUrl
|
||||
*/
|
||||
function scanForImportRules(cssRules, baseUrl) {
|
||||
if (!cssRules) return;
|
||||
for (var i = 0; i < cssRules.length; ++i) {
|
||||
if (cssRules[i].cssRules) {
|
||||
// @media rule: keep searching inside it.
|
||||
scanForImportRules.call(this, cssRules[i].cssRules, baseUrl);
|
||||
} else if (cssRules[i].href) {
|
||||
// @import rule: fetch the resource and evaluate it.
|
||||
// See http://dev.w3.org/csswg/cssom/#css-import-rule
|
||||
// If loading of the style sheet fails its cssRules list is simply
|
||||
// empty. I.e. an @import rule always has an associated style sheet.
|
||||
fetchStylesheet.call(this, cssRules[i].href, this.sheet);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} data
|
||||
* @param {cssstyle.CSSStyleDeclaration} style
|
||||
*/
|
||||
function evaluateStyleAttribute(data) {
|
||||
// this is the element.
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Subclass of core.Attr that reflects the current cssText.
|
||||
*/
|
||||
function StyleAttr(node, value) {
|
||||
this._node = node;
|
||||
core.Attr.call(this, node.ownerDocument, 'style');
|
||||
if (!this._node._ignoreValueOfStyleAttr) {
|
||||
this.nodeValue = value;
|
||||
}
|
||||
}
|
||||
inheritFrom(core.Attr, StyleAttr, {
|
||||
get nodeValue() {
|
||||
if (typeof this._node._style === 'string') {
|
||||
return this._node._style;
|
||||
} else {
|
||||
return this._node.style.cssText;
|
||||
}
|
||||
},
|
||||
set nodeValue(value) {
|
||||
this._node._style = value;
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* Overwrite core.AttrNodeMap#setNamedItem to create a StyleAttr instance
|
||||
* instead of a core.Attr if the name equals 'style'.
|
||||
*/
|
||||
utils.intercept(core.AttributeList, '$setNode', function(_super, args, attr) {
|
||||
if (attr.name == 'style') {
|
||||
attr = new StyleAttr(this._parentNode, attr.nodeValue);
|
||||
}
|
||||
return _super.call(this, attr);
|
||||
});
|
||||
|
||||
/**
|
||||
* Lazily create a CSSStyleDeclaration.
|
||||
*/
|
||||
defineGetter(html.HTMLElement.prototype, 'style', function() {
|
||||
if (typeof this._style === 'string') {
|
||||
// currently, cssom's parse doesn't really work if you pass in
|
||||
// {state: 'name'}, so instead we just build a dummy sheet.
|
||||
var styleSheet = cssom.parse('dummy{' + this._style + '}');
|
||||
this._style = new cssstyle.CSSStyleDeclaration();
|
||||
if (styleSheet.cssRules.length > 0 && styleSheet.cssRules[0].style) {
|
||||
var newStyle = styleSheet.cssRules[0].style;
|
||||
for (var i = 0; i < newStyle.length; ++i) {
|
||||
var prop = newStyle[i];
|
||||
this._style.setProperty(
|
||||
prop,
|
||||
newStyle.getPropertyValue(prop),
|
||||
newStyle.getPropertyPriority(prop));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!this._style) {
|
||||
this._style = new cssstyle.CSSStyleDeclaration();
|
||||
|
||||
}
|
||||
if (!this.getAttributeNode('style')) {
|
||||
// Tell the StyleAttr constructor to not overwrite this._style
|
||||
this._ignoreValueOfStyleAttr = true;
|
||||
this.setAttribute('style');
|
||||
this._ignoreValueOfStyleAttr = false;
|
||||
}
|
||||
return this._style;
|
||||
});
|
||||
|
||||
assert.equal(undefined, html.HTMLLinkElement._init);
|
||||
html.HTMLLinkElement._init = function() {
|
||||
this.addEventListener('DOMNodeInsertedIntoDocument', function() {
|
||||
if (!/(?:[ \t\n\r\f]|^)stylesheet(?:[ \t\n\r\f]|$)/i.test(this.rel)) {
|
||||
// rel is a space-separated list of tokens, and the original rel types
|
||||
// are case-insensitive.
|
||||
return;
|
||||
}
|
||||
if (this.href) {
|
||||
fetchStylesheet.call(this, this.href, this.sheet);
|
||||
}
|
||||
});
|
||||
this.addEventListener('DOMNodeRemovedFromDocument', function() {
|
||||
});
|
||||
};
|
||||
/**
|
||||
* @this {HTMLStyleElement|HTMLLinkElement}
|
||||
*/
|
||||
var getOrCreateSheet = function() {
|
||||
if (!this._cssStyleSheet) {
|
||||
this._cssStyleSheet = new cssom.CSSStyleSheet();
|
||||
}
|
||||
return this._cssStyleSheet;
|
||||
};
|
||||
defineGetter(html.HTMLLinkElement.prototype, 'sheet', getOrCreateSheet);
|
||||
|
||||
assert.equal(undefined, html.HTMLStyleElement._init);
|
||||
html.HTMLStyleElement._init = function() {
|
||||
//console.log('init style')
|
||||
this.addEventListener('DOMNodeInsertedIntoDocument', function() {
|
||||
//console.log('style inserted')
|
||||
//console.log('sheet: ', this.sheet);
|
||||
if (this.type && this.type !== 'text/css') {
|
||||
//console.log('bad type: ' + this.type)
|
||||
return;
|
||||
}
|
||||
var content = '';
|
||||
Array.prototype.forEach.call(this.childNodes, function (child) {
|
||||
if (child.nodeType === child.TEXT_NODE) { // text node
|
||||
content += child.nodeValue;
|
||||
}
|
||||
});
|
||||
evaluateStylesheet.call(this, content, this.sheet, this._ownerDocument.URL);
|
||||
});
|
||||
};
|
||||
defineGetter(html.HTMLStyleElement.prototype, 'sheet', getOrCreateSheet);
|
||||
|
||||
exports.dom = {
|
||||
level2 : {
|
||||
html : html,
|
||||
core : core
|
||||
}
|
||||
};
|
661
bower_components/jsdom/lib/jsdom/level3/core.js
vendored
661
bower_components/jsdom/lib/jsdom/level3/core.js
vendored
@ -1,661 +0,0 @@
|
||||
var events = require("../level2/events"),
|
||||
core = require("../level2/core").dom.level2.core,
|
||||
defineGetter = require('../utils').defineGetter,
|
||||
defineSetter = require('../utils').defineSetter,
|
||||
HtmlToDom = require('../browser/htmltodom').HtmlToDom,
|
||||
domToHtml = require('../browser/domtohtml').domToHtml,
|
||||
htmlencoding = require('../browser/htmlencoding'),
|
||||
HTMLEncode = htmlencoding.HTMLEncode,
|
||||
HTMLDecode = htmlencoding.HTMLDecode;
|
||||
|
||||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325
|
||||
core = Object.create(core);
|
||||
|
||||
/*
|
||||
valuetype DOMString sequence<unsigned short>;
|
||||
typedef unsigned long long DOMTimeStamp;
|
||||
typedef any DOMUserData;
|
||||
typedef Object DOMObject;
|
||||
|
||||
*/
|
||||
// ExceptionCode
|
||||
core.VALIDATION_ERR = 16;
|
||||
core.TYPE_MISMATCH_ERR = 17;
|
||||
|
||||
/*
|
||||
// Introduced in DOM Level 3:
|
||||
interface NameList {
|
||||
DOMString getName(in unsigned long index);
|
||||
DOMString getNamespaceURI(in unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
boolean contains(in DOMString str);
|
||||
boolean containsNS(in DOMString namespaceURI,
|
||||
in DOMString name);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface DOMImplementationList {
|
||||
DOMImplementation item(in unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface DOMImplementationSource {
|
||||
DOMImplementation getDOMImplementation(in DOMString features);
|
||||
DOMImplementationList getDOMImplementationList(in DOMString features);
|
||||
};
|
||||
*/
|
||||
|
||||
|
||||
core.DOMImplementation.prototype.getFeature = function(feature, version) {
|
||||
|
||||
};
|
||||
|
||||
/*
|
||||
interface Node {
|
||||
// Modified in DOM Level 3:
|
||||
Node insertBefore(in Node newChild,
|
||||
in Node refChild)
|
||||
raises(DOMException);
|
||||
// Modified in DOM Level 3:
|
||||
Node replaceChild(in Node newChild,
|
||||
in Node oldChild)
|
||||
raises(DOMException);
|
||||
// Modified in DOM Level 3:
|
||||
Node removeChild(in Node oldChild)
|
||||
raises(DOMException);
|
||||
// Modified in DOM Level 3:
|
||||
Node appendChild(in Node newChild)
|
||||
raises(DOMException);
|
||||
boolean hasChildNodes();
|
||||
Node cloneNode(in boolean deep);
|
||||
// Modified in DOM Level 3:
|
||||
void normalize();
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString baseURI;
|
||||
*/
|
||||
|
||||
// Compare Document Position
|
||||
var DOCUMENT_POSITION_DISCONNECTED = core.Node.prototype.DOCUMENT_POSITION_DISCONNECTED = 0x01;
|
||||
var DOCUMENT_POSITION_PRECEDING = core.Node.prototype.DOCUMENT_POSITION_PRECEDING = 0x02;
|
||||
var DOCUMENT_POSITION_FOLLOWING = core.Node.prototype.DOCUMENT_POSITION_FOLLOWING = 0x04;
|
||||
var DOCUMENT_POSITION_CONTAINS = core.Node.prototype.DOCUMENT_POSITION_CONTAINS = 0x08;
|
||||
var DOCUMENT_POSITION_CONTAINED_BY = core.Node.prototype.DOCUMENT_POSITION_CONTAINED_BY = 0x10;
|
||||
var DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = core.Node.prototype.DOCUMENT_POSITION_IMPLEMENTATION_SPECIFIC = 0x20;
|
||||
var DOCUMENT_TYPE_NODE = core.Node.prototype.DOCUMENT_TYPE_NODE;
|
||||
|
||||
core.Node.prototype.compareDocumentPosition = function compareDocumentPosition( otherNode ) {
|
||||
if( !(otherNode instanceof core.Node) ) {
|
||||
throw Error("Comparing position against non-Node values is not allowed")
|
||||
}
|
||||
var thisOwner, otherOwner;
|
||||
|
||||
if( this.nodeType === this.DOCUMENT_NODE)
|
||||
thisOwner = this
|
||||
else
|
||||
thisOwner = this.ownerDocument
|
||||
|
||||
if( otherNode.nodeType === this.DOCUMENT_NODE)
|
||||
otherOwner = otherNode
|
||||
else
|
||||
otherOwner = otherNode.ownerDocument
|
||||
|
||||
if( this === otherNode ) return 0
|
||||
if( this === otherNode.ownerDocument ) return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY
|
||||
if( this.ownerDocument === otherNode ) return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS
|
||||
if( thisOwner !== otherOwner ) return DOCUMENT_POSITION_DISCONNECTED
|
||||
|
||||
// Text nodes for attributes does not have a _parentNode. So we need to find them as attribute child.
|
||||
if( this.nodeType === this.ATTRIBUTE_NODE && this._childNodes && this._childNodes._toArray().indexOf(otherNode) !== -1)
|
||||
return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY
|
||||
|
||||
if( otherNode.nodeType === this.ATTRIBUTE_NODE && otherNode._childNodes && otherNode._childNodes._toArray().indexOf(this) !== -1)
|
||||
return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS
|
||||
|
||||
var point = this
|
||||
var parents = [ ]
|
||||
var previous = null
|
||||
while( point ) {
|
||||
if( point == otherNode ) return DOCUMENT_POSITION_PRECEDING + DOCUMENT_POSITION_CONTAINS
|
||||
parents.push( point )
|
||||
point = point._parentNode
|
||||
}
|
||||
point = otherNode
|
||||
previous = null
|
||||
while( point ) {
|
||||
if( point == this ) return DOCUMENT_POSITION_FOLLOWING + DOCUMENT_POSITION_CONTAINED_BY
|
||||
var location_index = parents.indexOf( point )
|
||||
if( location_index !== -1) {
|
||||
var smallest_common_ancestor = parents[ location_index ]
|
||||
var this_index = smallest_common_ancestor._childNodes._toArray().indexOf( parents[location_index - 1] )
|
||||
var other_index = smallest_common_ancestor._childNodes._toArray().indexOf( previous )
|
||||
if( this_index > other_index ) {
|
||||
return DOCUMENT_POSITION_PRECEDING
|
||||
}
|
||||
else {
|
||||
return DOCUMENT_POSITION_FOLLOWING
|
||||
}
|
||||
}
|
||||
previous = point
|
||||
point = point._parentNode
|
||||
}
|
||||
return DOCUMENT_POSITION_DISCONNECTED
|
||||
};
|
||||
/*
|
||||
// Introduced in DOM Level 3:
|
||||
attribute DOMString textContent;
|
||||
// raises(DOMException) on setting
|
||||
// raises(DOMException) on retrieval
|
||||
*/
|
||||
core.Node.prototype.isSameNode = function(other) {
|
||||
return (other === this);
|
||||
};
|
||||
|
||||
// @see http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407/core.html#Node3-textContent
|
||||
defineGetter(core.Node.prototype, 'textContent', function() {
|
||||
switch (this.nodeType) {
|
||||
case this.COMMENT_NODE:
|
||||
case this.CDATA_SECTION_NODE:
|
||||
case this.PROCESSING_INSTRUCTION_NODE:
|
||||
case this.TEXT_NODE:
|
||||
return this.nodeValue;
|
||||
|
||||
case this.ATTRIBUTE_NODE:
|
||||
case this.DOCUMENT_FRAGMENT_NODE:
|
||||
case this.ELEMENT_NODE:
|
||||
case this.ENTITY_NODE:
|
||||
case this.ENTITY_REFERENCE_NODE:
|
||||
var out = '';
|
||||
for (var i = 0 ; i < this.childNodes.length ; ++i) {
|
||||
if (this.childNodes[i].nodeType !== this.COMMENT_NODE &&
|
||||
this.childNodes[i].nodeType !== this.PROCESSING_INSTRUCTION_NODE) {
|
||||
out += this.childNodes[i].textContent || '';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
});
|
||||
|
||||
defineSetter(core.Node.prototype, 'textContent', function(txt) {
|
||||
for (var i = this.childNodes.length; --i >=0;) {
|
||||
this.removeChild(this.childNodes.item(i));
|
||||
}
|
||||
if (txt !== "" && txt != null) {
|
||||
this.appendChild(this._ownerDocument.createTextNode(txt));
|
||||
}
|
||||
return txt;
|
||||
});
|
||||
|
||||
/*
|
||||
// Introduced in DOM Level 3:
|
||||
DOMString lookupPrefix(in DOMString namespaceURI);
|
||||
// Introduced in DOM Level 3:
|
||||
boolean isDefaultNamespace(in DOMString namespaceURI);
|
||||
// Introduced in DOM Level 3:
|
||||
DOMString lookupNamespaceURI(in DOMString prefix);
|
||||
*/
|
||||
// Introduced in DOM Level 3:
|
||||
core.Node.prototype.isEqualNode = function(other) {
|
||||
var self = this;
|
||||
var diffValues = function() {
|
||||
for (var i=0;i<arguments.length;i++) {
|
||||
var k = arguments[i];
|
||||
if (self[k] != other[k]) return(true);
|
||||
}
|
||||
return(false);
|
||||
};
|
||||
var diffNamedNodeMaps = function(snnm, onnm) {
|
||||
if ((snnm == null) && (onnm == null)) return(false);
|
||||
if ((snnm == null) || (onnm == null)) return(true);
|
||||
if (snnm.length != onnm.length) return(true);
|
||||
var js = [];
|
||||
for (var j=0;j<onnm.length;j++) { js[j] = j }
|
||||
for (var i=0;i<snnm.length;i++) {
|
||||
var found=false;
|
||||
for (var j=0;j<js.length;j++) {
|
||||
if (snnm.item(i).isEqualNode(onnm.item(js[j]))) {
|
||||
found = true;
|
||||
// in order to be 100% accurate, we remove index values from consideration once they've matched
|
||||
js.splice(j,1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) return(true);
|
||||
}
|
||||
return(false);
|
||||
};
|
||||
var diffNodeLists = function(snl, onl) {
|
||||
if ((snl == null) && (onl == null)) return(false);
|
||||
if ((snl == null) || (onl == null)) return(true);
|
||||
if (snl.length != onl.length) return(true);
|
||||
for (var i=0;i<snl.length;i++) {
|
||||
if (!snl.item(i).isEqualNode(onl.item(i))) return(true);
|
||||
}
|
||||
return(false);
|
||||
};
|
||||
if (!other) return(false);
|
||||
if (this.isSameNode(other)) return(true);
|
||||
if (this.nodeType != other.nodeType) return(false);
|
||||
if (diffValues('nodeName', 'localName', 'namespaceURI', 'prefix', 'nodeValue')) return(false);
|
||||
if (diffNamedNodeMaps(this.attributes, other.attributes)) return(false);
|
||||
if (diffNodeLists(this.childNodes, other.childNodes)) return(false);
|
||||
if (this.nodeType == DOCUMENT_TYPE_NODE) {
|
||||
if (diffValues('publicId', 'systemId', 'internalSubset')) return(false);
|
||||
if (diffNamedNodeMaps(this.entities, other.entities)) return(false);
|
||||
if (diffNamedNodeMaps(this.notations, other.notations)) return(false);
|
||||
}
|
||||
return (true);
|
||||
};
|
||||
/*
|
||||
// Introduced in DOM Level 3:
|
||||
DOMObject getFeature(in DOMString feature,
|
||||
in DOMString version);
|
||||
*/
|
||||
// Introduced in DOM Level 3:
|
||||
core.Node.prototype.setUserData = function(key, data, handler) {
|
||||
var r = this[key] || null;
|
||||
this[key] = data;
|
||||
return(r);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
core.Node.prototype.getUserData = function(key) {
|
||||
var r = this[key] || null;
|
||||
return(r);
|
||||
};
|
||||
/*
|
||||
interface NodeList {
|
||||
Node item(in unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
};
|
||||
|
||||
interface NamedNodeMap {
|
||||
Node getNamedItem(in DOMString name);
|
||||
Node setNamedItem(in Node arg)
|
||||
raises(DOMException);
|
||||
Node removeNamedItem(in DOMString name)
|
||||
raises(DOMException);
|
||||
Node item(in unsigned long index);
|
||||
readonly attribute unsigned long length;
|
||||
// Introduced in DOM Level 2:
|
||||
Node getNamedItemNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
Node setNamedItemNS(in Node arg)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
Node removeNamedItemNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
};
|
||||
|
||||
interface CharacterData : Node {
|
||||
attribute DOMString data;
|
||||
// raises(DOMException) on setting
|
||||
// raises(DOMException) on retrieval
|
||||
|
||||
readonly attribute unsigned long length;
|
||||
DOMString substringData(in unsigned long offset,
|
||||
in unsigned long count)
|
||||
raises(DOMException);
|
||||
void appendData(in DOMString arg)
|
||||
raises(DOMException);
|
||||
void insertData(in unsigned long offset,
|
||||
in DOMString arg)
|
||||
raises(DOMException);
|
||||
void deleteData(in unsigned long offset,
|
||||
in unsigned long count)
|
||||
raises(DOMException);
|
||||
void replaceData(in unsigned long offset,
|
||||
in unsigned long count,
|
||||
in DOMString arg)
|
||||
raises(DOMException);
|
||||
};
|
||||
|
||||
interface Attr : Node {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute boolean specified;
|
||||
attribute DOMString value;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
readonly attribute Element ownerElement;
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute TypeInfo schemaTypeInfo;
|
||||
|
||||
*/
|
||||
// Introduced in DOM Level 3:
|
||||
defineGetter(core.Attr.prototype, 'isId', function() {
|
||||
return (this.name.toLowerCase() === 'id');
|
||||
});
|
||||
/*
|
||||
};
|
||||
|
||||
interface Element : Node {
|
||||
readonly attribute DOMString tagName;
|
||||
DOMString getAttribute(in DOMString name);
|
||||
void setAttribute(in DOMString name,
|
||||
in DOMString value)
|
||||
raises(DOMException);
|
||||
void removeAttribute(in DOMString name)
|
||||
raises(DOMException);
|
||||
Attr getAttributeNode(in DOMString name);
|
||||
Attr setAttributeNode(in Attr newAttr)
|
||||
raises(DOMException);
|
||||
Attr removeAttributeNode(in Attr oldAttr)
|
||||
raises(DOMException);
|
||||
NodeList getElementsByTagName(in DOMString name);
|
||||
// Introduced in DOM Level 2:
|
||||
DOMString getAttributeNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
void setAttributeNS(in DOMString namespaceURI,
|
||||
in DOMString qualifiedName,
|
||||
in DOMString value)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
void removeAttributeNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
Attr getAttributeNodeNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
Attr setAttributeNodeNS(in Attr newAttr)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
NodeList getElementsByTagNameNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
boolean hasAttribute(in DOMString name);
|
||||
// Introduced in DOM Level 2:
|
||||
boolean hasAttributeNS(in DOMString namespaceURI,
|
||||
in DOMString localName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute TypeInfo schemaTypeInfo;
|
||||
// Introduced in DOM Level 3:
|
||||
void setIdAttribute(in DOMString name,
|
||||
in boolean isId)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
void setIdAttributeNS(in DOMString namespaceURI,
|
||||
in DOMString localName,
|
||||
in boolean isId)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
void setIdAttributeNode(in Attr idAttr,
|
||||
in boolean isId)
|
||||
raises(DOMException);
|
||||
};
|
||||
|
||||
interface Text : CharacterData {
|
||||
Text splitText(in unsigned long offset)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute boolean isElementContentWhitespace;
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString wholeText;
|
||||
// Introduced in DOM Level 3:
|
||||
Text replaceWholeText(in DOMString content)
|
||||
raises(DOMException);
|
||||
};
|
||||
|
||||
interface Comment : CharacterData {
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface TypeInfo {
|
||||
readonly attribute DOMString typeName;
|
||||
readonly attribute DOMString typeNamespace;
|
||||
|
||||
// DerivationMethods
|
||||
const unsigned long DERIVATION_RESTRICTION = 0x00000001;
|
||||
const unsigned long DERIVATION_EXTENSION = 0x00000002;
|
||||
const unsigned long DERIVATION_UNION = 0x00000004;
|
||||
const unsigned long DERIVATION_LIST = 0x00000008;
|
||||
|
||||
boolean isDerivedFrom(in DOMString typeNamespaceArg,
|
||||
in DOMString typeNameArg,
|
||||
in unsigned long derivationMethod);
|
||||
};
|
||||
*/
|
||||
// Introduced in DOM Level 3:
|
||||
core.UserDataHandler = function() {};
|
||||
core.UserDataHandler.prototype.NODE_CLONED = 1;
|
||||
core.UserDataHandler.prototype.NODE_IMPORTED = 2;
|
||||
core.UserDataHandler.prototype.NODE_DELETED = 3;
|
||||
core.UserDataHandler.prototype.NODE_RENAMED = 4;
|
||||
core.UserDataHandler.prototype.NODE_ADOPTED = 5;
|
||||
core.UserDataHandler.prototype.handle = function(operation, key, data, src, dst) {};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
core.DOMError = function(severity, message, type, relatedException, relatedData, location) {
|
||||
this._severity = severity;
|
||||
this._message = message;
|
||||
this._type = type;
|
||||
this._relatedException = relatedException;
|
||||
this._relatedData = relatedData;
|
||||
this._location = location;
|
||||
};
|
||||
core.DOMError.prototype = {};
|
||||
core.DOMError.prototype.SEVERITY_WARNING = 1;
|
||||
core.DOMError.prototype.SEVERITY_ERROR = 2;
|
||||
core.DOMError.prototype.SEVERITY_FATAL_ERROR = 3;
|
||||
defineGetter(core.DOMError.prototype, 'severity', function() {
|
||||
return this._severity;
|
||||
});
|
||||
defineGetter(core.DOMError.prototype, 'message', function() {
|
||||
return this._message;
|
||||
});
|
||||
defineGetter(core.DOMError.prototype, 'type', function() {
|
||||
return this._type;
|
||||
});
|
||||
defineGetter(core.DOMError.prototype, 'relatedException', function() {
|
||||
return this._relatedException;
|
||||
});
|
||||
defineGetter(core.DOMError.prototype, 'relatedData', function() {
|
||||
return this._relatedData;
|
||||
});
|
||||
defineGetter(core.DOMError.prototype, 'location', function() {
|
||||
return this._location;
|
||||
});
|
||||
|
||||
/*
|
||||
// Introduced in DOM Level 3:
|
||||
interface DOMErrorHandler {
|
||||
boolean handleError(in DOMError error);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface DOMLocator {
|
||||
readonly attribute long lineNumber;
|
||||
readonly attribute long columnNumber;
|
||||
readonly attribute long byteOffset;
|
||||
readonly attribute long utf16Offset;
|
||||
readonly attribute Node relatedNode;
|
||||
readonly attribute DOMString uri;
|
||||
};
|
||||
*/
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
core.DOMConfiguration = function(){
|
||||
var possibleParameterNames = {
|
||||
'canonical-form': [false, true], // extra rules for true
|
||||
'cdata-sections': [true, false],
|
||||
'check-character-normalization': [false, true],
|
||||
'comments': [true, false],
|
||||
'datatype-normalization': [false, true],
|
||||
'element-content-whitespace': [true, false],
|
||||
'entities': [true, false],
|
||||
// 'error-handler': [],
|
||||
'infoset': [undefined, true, false], // extra rules for true
|
||||
'namespaces': [true, false],
|
||||
'namespace-declarations': [true, false], // only checked if namespaces is true
|
||||
'normalize-characters': [false, true],
|
||||
// 'schema-location': [],
|
||||
// 'schema-type': [],
|
||||
'split-cdata-sections': [true, false],
|
||||
'validate': [false, true],
|
||||
'validate-if-schema': [false, true],
|
||||
'well-formed': [true, false]
|
||||
}
|
||||
};
|
||||
|
||||
core.DOMConfiguration.prototype = {
|
||||
setParameter: function(name, value) {},
|
||||
getParameter: function(name) {},
|
||||
canSetParameter: function(name, value) {},
|
||||
parameterNames: function() {}
|
||||
};
|
||||
|
||||
//core.Document.prototype._domConfig = new core.DOMConfiguration();
|
||||
defineGetter(core.Document.prototype, 'domConfig', function() {
|
||||
return this._domConfig || new core.DOMConfiguration();;
|
||||
});
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
core.DOMStringList = function() {};
|
||||
|
||||
core.DOMStringList.prototype = {
|
||||
item: function() {},
|
||||
length: function() {},
|
||||
contains: function() {}
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
interface CDATASection : Text {
|
||||
};
|
||||
|
||||
interface DocumentType : Node {
|
||||
readonly attribute DOMString name;
|
||||
readonly attribute NamedNodeMap entities;
|
||||
readonly attribute NamedNodeMap notations;
|
||||
// Introduced in DOM Level 2:
|
||||
readonly attribute DOMString publicId;
|
||||
// Introduced in DOM Level 2:
|
||||
readonly attribute DOMString systemId;
|
||||
// Introduced in DOM Level 2:
|
||||
readonly attribute DOMString internalSubset;
|
||||
};
|
||||
|
||||
interface Notation : Node {
|
||||
readonly attribute DOMString publicId;
|
||||
readonly attribute DOMString systemId;
|
||||
};
|
||||
|
||||
interface Entity : Node {
|
||||
readonly attribute DOMString publicId;
|
||||
readonly attribute DOMString systemId;
|
||||
readonly attribute DOMString notationName;
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString inputEncoding;
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString xmlEncoding;
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString xmlVersion;
|
||||
};
|
||||
|
||||
interface EntityReference : Node {
|
||||
};
|
||||
|
||||
interface ProcessingInstruction : Node {
|
||||
readonly attribute DOMString target;
|
||||
attribute DOMString data;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
};
|
||||
|
||||
interface DocumentFragment : Node {
|
||||
};
|
||||
|
||||
interface Document : Node {
|
||||
// Modified in DOM Level 3:
|
||||
readonly attribute DocumentType doctype;
|
||||
readonly attribute DOMImplementation implementation;
|
||||
readonly attribute Element documentElement;
|
||||
Element createElement(in DOMString tagName)
|
||||
raises(DOMException);
|
||||
DocumentFragment createDocumentFragment();
|
||||
Text createTextNode(in DOMString data);
|
||||
Comment createComment(in DOMString data);
|
||||
CDATASection createCDATASection(in DOMString data)
|
||||
raises(DOMException);
|
||||
ProcessingInstruction createProcessingInstruction(in DOMString target,
|
||||
in DOMString data)
|
||||
raises(DOMException);
|
||||
Attr createAttribute(in DOMString name)
|
||||
raises(DOMException);
|
||||
EntityReference createEntityReference(in DOMString name)
|
||||
raises(DOMException);
|
||||
NodeList getElementsByTagName(in DOMString tagname);
|
||||
// Introduced in DOM Level 2:
|
||||
Node importNode(in Node importedNode,
|
||||
in boolean deep)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
Element createElementNS(in DOMString namespaceURI,
|
||||
in DOMString qualifiedName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
Attr createAttributeNS(in DOMString namespaceURI,
|
||||
in DOMString qualifiedName)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 2:
|
||||
NodeList getElementsByTagNameNS(in DOMString namespaceURI,
|
||||
in DOMString localName);
|
||||
// Introduced in DOM Level 2:
|
||||
Element getElementById(in DOMString elementId);
|
||||
*/
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
core.Document.prototype._inputEncoding = null;
|
||||
defineGetter(core.Document.prototype, 'inputEncoding', function() {
|
||||
return this._inputEncoding;
|
||||
});
|
||||
/*
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString xmlEncoding;
|
||||
// Introduced in DOM Level 3:
|
||||
attribute boolean xmlStandalone;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
attribute DOMString xmlVersion;
|
||||
// raises(DOMException) on setting
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
attribute boolean strictErrorChecking;
|
||||
// Introduced in DOM Level 3:
|
||||
attribute DOMString documentURI;
|
||||
// Introduced in DOM Level 3:
|
||||
Node adoptNode(in Node source)
|
||||
raises(DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMConfiguration domConfig;
|
||||
// Introduced in DOM Level 3:
|
||||
void normalizeDocument();
|
||||
// Introduced in DOM Level 3:
|
||||
Node renameNode(in Node n,
|
||||
in DOMString namespaceURI,
|
||||
in DOMString qualifiedName)
|
||||
raises(DOMException);
|
||||
};
|
||||
};
|
||||
|
||||
#endif // _DOM_IDL_
|
||||
*/
|
||||
|
||||
exports.dom = {
|
||||
level3 : {
|
||||
core: core
|
||||
}
|
||||
};
|
299
bower_components/jsdom/lib/jsdom/level3/events.js
vendored
299
bower_components/jsdom/lib/jsdom/level3/events.js
vendored
@ -1,299 +0,0 @@
|
||||
var events = require("../level2/events").dom.level2.events;
|
||||
|
||||
// modify cloned instance for more info check: https://github.com/tmpvar/jsdom/issues/325
|
||||
events = Object.create(events);
|
||||
|
||||
/*
|
||||
|
||||
// File: events.idl
|
||||
|
||||
#ifndef _EVENTS_IDL_
|
||||
#define _EVENTS_IDL_
|
||||
|
||||
#include "dom.idl"
|
||||
#include "views.idl"
|
||||
|
||||
#pragma prefix "dom.w3c.org"
|
||||
module events
|
||||
{
|
||||
|
||||
typedef dom::DOMString DOMString;
|
||||
typedef dom::DOMTimeStamp DOMTimeStamp;
|
||||
typedef dom::DOMObject DOMObject;
|
||||
typedef dom::Node Node;
|
||||
|
||||
interface EventTarget;
|
||||
interface EventListener;
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
exception EventException {
|
||||
unsigned short code;
|
||||
};
|
||||
// EventExceptionCode
|
||||
const unsigned short UNSPECIFIED_EVENT_TYPE_ERR = 0;
|
||||
// Introduced in DOM Level 3:
|
||||
const unsigned short DISPATCH_REQUEST_ERR = 1;
|
||||
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface Event {
|
||||
|
||||
// PhaseType
|
||||
const unsigned short CAPTURING_PHASE = 1;
|
||||
const unsigned short AT_TARGET = 2;
|
||||
const unsigned short BUBBLING_PHASE = 3;
|
||||
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute EventTarget target;
|
||||
readonly attribute EventTarget currentTarget;
|
||||
readonly attribute unsigned short eventPhase;
|
||||
readonly attribute boolean bubbles;
|
||||
readonly attribute boolean cancelable;
|
||||
readonly attribute DOMTimeStamp timeStamp;
|
||||
void stopPropagation();
|
||||
void preventDefault();
|
||||
void initEvent(in DOMString eventTypeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg);
|
||||
// Introduced in DOM Level 3:
|
||||
readonly attribute DOMString namespaceURI;
|
||||
// Introduced in DOM Level 3:
|
||||
boolean isCustom();
|
||||
// Introduced in DOM Level 3:
|
||||
void stopImmediatePropagation();
|
||||
// Introduced in DOM Level 3:
|
||||
boolean isDefaultPrevented();
|
||||
// Introduced in DOM Level 3:
|
||||
void initEventNS(in DOMString namespaceURIArg,
|
||||
in DOMString eventTypeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface EventTarget {
|
||||
void addEventListener(in DOMString type,
|
||||
in EventListener listener,
|
||||
in boolean useCapture);
|
||||
void removeEventListener(in DOMString type,
|
||||
in EventListener listener,
|
||||
in boolean useCapture);
|
||||
// Modified in DOM Level 3:
|
||||
boolean dispatchEvent(in Event evt)
|
||||
raises(EventException);
|
||||
// Introduced in DOM Level 3:
|
||||
void addEventListenerNS(in DOMString namespaceURI,
|
||||
in DOMString type,
|
||||
in EventListener listener,
|
||||
in boolean useCapture,
|
||||
in DOMObject evtGroup);
|
||||
// Introduced in DOM Level 3:
|
||||
void removeEventListenerNS(in DOMString namespaceURI,
|
||||
in DOMString type,
|
||||
in EventListener listener,
|
||||
in boolean useCapture);
|
||||
// Introduced in DOM Level 3:
|
||||
boolean willTriggerNS(in DOMString namespaceURI,
|
||||
in DOMString type);
|
||||
// Introduced in DOM Level 3:
|
||||
boolean hasEventListenerNS(in DOMString namespaceURI,
|
||||
in DOMString type);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface EventListener {
|
||||
void handleEvent(in Event evt);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface DocumentEvent {
|
||||
Event createEvent(in DOMString eventType)
|
||||
raises(dom::DOMException);
|
||||
// Introduced in DOM Level 3:
|
||||
boolean canDispatch(in DOMString namespaceURI,
|
||||
in DOMString type);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface CustomEvent : Event {
|
||||
void setDispatchState(in EventTarget target,
|
||||
in unsigned short phase);
|
||||
boolean isPropagationStopped();
|
||||
boolean isImmediatePropagationStopped();
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface UIEvent : Event {
|
||||
readonly attribute views::AbstractView view;
|
||||
readonly attribute long detail;
|
||||
void initUIEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in long detailArg);
|
||||
// Introduced in DOM Level 3:
|
||||
void initUIEventNS(in DOMString namespaceURI,
|
||||
in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in long detailArg);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface TextEvent : UIEvent {
|
||||
readonly attribute DOMString data;
|
||||
void initTextEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in DOMString dataArg);
|
||||
void initTextEventNS(in DOMString namespaceURI,
|
||||
in DOMString type,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in DOMString dataArg);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface MouseEvent : UIEvent {
|
||||
readonly attribute long screenX;
|
||||
readonly attribute long screenY;
|
||||
readonly attribute long clientX;
|
||||
readonly attribute long clientY;
|
||||
readonly attribute boolean ctrlKey;
|
||||
readonly attribute boolean shiftKey;
|
||||
readonly attribute boolean altKey;
|
||||
readonly attribute boolean metaKey;
|
||||
readonly attribute unsigned short button;
|
||||
readonly attribute EventTarget relatedTarget;
|
||||
void initMouseEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
in long clientXArg,
|
||||
in long clientYArg,
|
||||
in boolean ctrlKeyArg,
|
||||
in boolean altKeyArg,
|
||||
in boolean shiftKeyArg,
|
||||
in boolean metaKeyArg,
|
||||
in unsigned short buttonArg,
|
||||
in EventTarget relatedTargetArg);
|
||||
// Introduced in DOM Level 3:
|
||||
boolean getModifierState(in DOMString keyIdentifierArg);
|
||||
// Introduced in DOM Level 3:
|
||||
void initMouseEventNS(in DOMString namespaceURI,
|
||||
in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in long detailArg,
|
||||
in long screenXArg,
|
||||
in long screenYArg,
|
||||
in long clientXArg,
|
||||
in long clientYArg,
|
||||
in unsigned short buttonArg,
|
||||
in EventTarget relatedTargetArg,
|
||||
in DOMString modifiersList);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface KeyboardEvent : UIEvent {
|
||||
|
||||
// KeyLocationCode
|
||||
const unsigned long DOM_KEY_LOCATION_STANDARD = 0x00;
|
||||
const unsigned long DOM_KEY_LOCATION_LEFT = 0x01;
|
||||
const unsigned long DOM_KEY_LOCATION_RIGHT = 0x02;
|
||||
const unsigned long DOM_KEY_LOCATION_NUMPAD = 0x03;
|
||||
|
||||
readonly attribute DOMString keyIdentifier;
|
||||
readonly attribute unsigned long keyLocation;
|
||||
readonly attribute boolean ctrlKey;
|
||||
readonly attribute boolean shiftKey;
|
||||
readonly attribute boolean altKey;
|
||||
readonly attribute boolean metaKey;
|
||||
boolean getModifierState(in DOMString keyIdentifierArg);
|
||||
void initKeyboardEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in DOMString keyIdentifierArg,
|
||||
in unsigned long keyLocationArg,
|
||||
in DOMString modifiersList);
|
||||
void initKeyboardEventNS(in DOMString namespaceURI,
|
||||
in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in views::AbstractView viewArg,
|
||||
in DOMString keyIdentifierArg,
|
||||
in unsigned long keyLocationArg,
|
||||
in DOMString modifiersList);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 2:
|
||||
interface MutationEvent : Event {
|
||||
|
||||
// attrChangeType
|
||||
const unsigned short MODIFICATION = 1;
|
||||
const unsigned short ADDITION = 2;
|
||||
const unsigned short REMOVAL = 3;
|
||||
|
||||
readonly attribute Node relatedNode;
|
||||
readonly attribute DOMString prevValue;
|
||||
readonly attribute DOMString newValue;
|
||||
readonly attribute DOMString attrName;
|
||||
readonly attribute unsigned short attrChange;
|
||||
void initMutationEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in Node relatedNodeArg,
|
||||
in DOMString prevValueArg,
|
||||
in DOMString newValueArg,
|
||||
in DOMString attrNameArg,
|
||||
in unsigned short attrChangeArg);
|
||||
// Introduced in DOM Level 3:
|
||||
void initMutationEventNS(in DOMString namespaceURI,
|
||||
in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in Node relatedNodeArg,
|
||||
in DOMString prevValueArg,
|
||||
in DOMString newValueArg,
|
||||
in DOMString attrNameArg,
|
||||
in unsigned short attrChangeArg);
|
||||
};
|
||||
|
||||
// Introduced in DOM Level 3:
|
||||
interface MutationNameEvent : MutationEvent {
|
||||
readonly attribute DOMString prevNamespaceURI;
|
||||
readonly attribute DOMString prevNodeName;
|
||||
// Introduced in DOM Level 3:
|
||||
void initMutationNameEvent(in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in Node relatedNodeArg,
|
||||
in DOMString prevNamespaceURIArg,
|
||||
in DOMString prevNodeNameArg);
|
||||
// Introduced in DOM Level 3:
|
||||
void initMutationNameEventNS(in DOMString namespaceURI,
|
||||
in DOMString typeArg,
|
||||
in boolean canBubbleArg,
|
||||
in boolean cancelableArg,
|
||||
in Node relatedNodeArg,
|
||||
in DOMString prevNamespaceURIArg,
|
||||
in DOMString prevNodeNameArg);
|
||||
};
|
||||
};
|
||||
|
||||
#endif // _EVENTS_IDL_
|
||||
*/
|
||||
|
||||
exports.dom = {
|
||||
level3 : {
|
||||
events: events
|
||||
}
|
||||
}
|
@ -1,9 +0,0 @@
|
||||
var core = require("./core").dom.level3.core,
|
||||
html = require("../level2/html").dom.level2.html
|
||||
|
||||
exports.dom = {
|
||||
level3 : {
|
||||
html : html,
|
||||
core : core
|
||||
}
|
||||
};
|
10
bower_components/jsdom/lib/jsdom/level3/index.js
vendored
10
bower_components/jsdom/lib/jsdom/level3/index.js
vendored
@ -1,10 +0,0 @@
|
||||
module.exports.dom = {
|
||||
level3 : {
|
||||
core : require("./core").dom.level3.core,
|
||||
xpath : require("./xpath"),
|
||||
events : require("./events").dom.level3.events,
|
||||
html : require("./html").dom.level3.html,
|
||||
}
|
||||
};
|
||||
|
||||
module.exports.dom.ls = require('./ls').dom.level3.ls;
|
219
bower_components/jsdom/lib/jsdom/level3/ls.js
vendored
219
bower_components/jsdom/lib/jsdom/level3/ls.js
vendored
@ -1,219 +0,0 @@
|
||||
// w3c Load/Save functionality: http://www.w3.org/TR/2004/REC-DOM-Level-3-LS-20040407/
|
||||
|
||||
var core = require('./core').dom.level3.core;
|
||||
var events = require('./events').dom.level3.events;
|
||||
var createFrom = require('../utils').createFrom;
|
||||
|
||||
var ls = {};
|
||||
|
||||
// TODO: what is this?
|
||||
//typedef dom::DOMConfiguration DOMConfiguration;
|
||||
|
||||
ls.LSException = function LSException(code) {
|
||||
this.code = code;
|
||||
};
|
||||
|
||||
ls.LSException.prototype = {
|
||||
// LSExceptionCode
|
||||
PARSE_ERR : 81,
|
||||
SERIALIZE_ERR : 82
|
||||
};
|
||||
|
||||
ls.DOMImplementationLS = function DOMImplementationLS() {
|
||||
|
||||
};
|
||||
|
||||
var DOMImplementationExtension = {
|
||||
|
||||
// DOMImplementationLSMode
|
||||
MODE_SYNCHRONOUS : 1,
|
||||
MODE_ASYNCHRONOUS : 2,
|
||||
|
||||
// raises(dom::DOMException);
|
||||
createLSParser : function(/* int */ mode, /* string */ schemaType) {
|
||||
return new ls.LSParser(mode, schemaType);
|
||||
},
|
||||
|
||||
createLSSerializer : function() {
|
||||
return new ls.LSSerializer();
|
||||
},
|
||||
|
||||
createLSInput : function() {
|
||||
return new ls.LSInput();
|
||||
},
|
||||
|
||||
createLSOutput : function() {
|
||||
return new ls.LSOutput();
|
||||
}
|
||||
};
|
||||
|
||||
Object.keys(DOMImplementationExtension).forEach(function(k, v) {
|
||||
core.DOMImplementation.prototype[k] = DOMImplementationExtension[k];
|
||||
});
|
||||
|
||||
ls.DOMImplementationLS.prototype = DOMImplementationExtension;
|
||||
|
||||
core.Document.getFeature = function() {
|
||||
return DOMImplementationExtension;
|
||||
};
|
||||
|
||||
ls.LSParser = function LSParser() {
|
||||
this._domConfig = new core.DOMConfiguration();
|
||||
};
|
||||
ls.LSParser.prototype = {
|
||||
get domConfig() { return this._domConfig; },
|
||||
get filter() { return this._filter || null; },
|
||||
set filter(value) { this._filter = value; },
|
||||
get async() { return this._async; },
|
||||
get busy() { return this._busy; },
|
||||
|
||||
// raises(dom::DOMException, LSException);
|
||||
parse : function (/* LSInput */ input) {
|
||||
var doc = new core.Document();
|
||||
doc._inputEncoding = 'UTF-16';
|
||||
return doc;
|
||||
},
|
||||
|
||||
// raises(dom::DOMException, LSException);
|
||||
parseURI : function(/* string */ uri) {
|
||||
return new core.Document();
|
||||
},
|
||||
|
||||
// ACTION_TYPES
|
||||
ACTION_APPEND_AS_CHILDREN : 1,
|
||||
ACTION_REPLACE_CHILDREN : 2,
|
||||
ACTION_INSERT_BEFORE : 3,
|
||||
ACTION_INSERT_AFTER : 4,
|
||||
ACTION_REPLACE : 5,
|
||||
|
||||
// @returns Node
|
||||
// @raises DOMException, LSException
|
||||
parseWithContext : function(/* LSInput */ input, /* Node */ contextArg, /* int */ action) {
|
||||
return new core.Node();
|
||||
},
|
||||
|
||||
abort : function() {
|
||||
// TODO: implement
|
||||
}
|
||||
};
|
||||
|
||||
ls.LSInput = function LSInput() {};
|
||||
ls.LSInput.prototype = {
|
||||
get characterStream() { return this._characterStream || null; },
|
||||
set characterStream(value) { this._characterStream = value; },
|
||||
get byteStream() { return this._byteStream || null; },
|
||||
set byteStream(value) { this._byteStream = value; },
|
||||
get stringData() { return this._stringData || null; },
|
||||
set stringData(value) { this._stringData = value; },
|
||||
get systemId() { return this._systemId || null; },
|
||||
set systemId(value) { this._systemId = value; },
|
||||
get publicId() { return this._publicId || null; },
|
||||
set publicId(value) { this._publicId = value; },
|
||||
get baseURI() { return this._baseURI || null; },
|
||||
set baseURI(value) { this._baseURI = value; },
|
||||
get encoding() { return this._encoding || null; },
|
||||
set encoding(value) { this._encoding = value; },
|
||||
get certifiedText() { return this._certifiedText || null; },
|
||||
set certifiedText(value) { this._certifiedText = value; },
|
||||
};
|
||||
|
||||
ls.LSResourceResolver = function LSResourceResolver() {};
|
||||
|
||||
// @returns LSInput
|
||||
ls.LSResourceResolver.prototype.resolveResource = function(type, namespaceURI, publicId, systemId, baseURI) {
|
||||
return new ls.LSInput();
|
||||
};
|
||||
|
||||
ls.LSParserFilter = function LSParserFilter() {};
|
||||
ls.LSParserFilter.prototype = {
|
||||
|
||||
// Constants returned by startElement and acceptNode
|
||||
FILTER_ACCEPT : 1,
|
||||
FILTER_REJECT : 2,
|
||||
FILTER_SKIP : 3,
|
||||
FILTER_INTERRUPT : 4,
|
||||
|
||||
get whatToShow() { return this._whatToShow; },
|
||||
|
||||
// @returns int
|
||||
startElement : function(/* Element */ elementArg) {
|
||||
return 0;
|
||||
},
|
||||
|
||||
// @returns int
|
||||
acceptNode : function(/* Node */ nodeArg) {
|
||||
return nodeArg;
|
||||
}
|
||||
};
|
||||
|
||||
ls.LSSerializer = function LSSerializer() {
|
||||
this._domConfig = new core.DOMConfiguration();
|
||||
};
|
||||
ls.LSSerializer.prototype = {
|
||||
get domConfig() { return this._domConfig; },
|
||||
get newLine() { return this._newLine || null; },
|
||||
set newLine(value) { this._newLine = value; },
|
||||
get filter() { return this._filter || null; },
|
||||
set filter(value) { this._filter = value; },
|
||||
|
||||
// @returns boolean
|
||||
// @raises LSException
|
||||
write : function(/* Node */ nodeArg, /* LSOutput */ destination) {
|
||||
return true;
|
||||
},
|
||||
|
||||
// @returns boolean
|
||||
// @raises LSException
|
||||
writeToURI : function(/* Node */ nodeArg, /* string */ uri) {
|
||||
return true;
|
||||
},
|
||||
|
||||
// @returns string
|
||||
// @raises DOMException, LSException
|
||||
writeToString : function(/* Node */ nodeArg) {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
ls.LSOutput = function LSOutput() {};
|
||||
ls.LSOutput.prototype = {
|
||||
get characterStream() { return this._characterStream || null; },
|
||||
set characterStream(value) { this._characterStream = value; },
|
||||
get byteStream() { return this._byteStream || null; },
|
||||
set byteStream(value) { this._byteStream = value; },
|
||||
get systemId() { return this._systemId || null; },
|
||||
set systemId(value) { this._systemId = value; },
|
||||
get encoding() { return this._encoding || null; },
|
||||
set encoding(value) { this._encoding = value; },
|
||||
};
|
||||
|
||||
ls.LSProgressEvent = function LSProgressEvent() {};
|
||||
ls.LSProgressEvent.prototype = createFrom(events.Event, {
|
||||
constructor: ls.LSProgressEvent,
|
||||
get input() { return this._input; },
|
||||
get position() { return this._position; },
|
||||
get totalSize() { return this._totalSize; },
|
||||
});
|
||||
|
||||
ls.LSLoadEvent = function LSLoadEvent() {};
|
||||
ls.LSLoadEvent.prototype = createFrom(events.Event, {
|
||||
get newDocument() { return this._newDocument; },
|
||||
get input() { return this._input; },
|
||||
});
|
||||
|
||||
|
||||
// TODO: do traversal
|
||||
ls.LSSerializerFilter = function LSSerializerFilter() {};
|
||||
ls.LSSerializerFilter.prototype = {
|
||||
get whatToShow() { return this._whatToShow; },
|
||||
};
|
||||
|
||||
// ls.LSSerializerFilter.prototype.__proto__ = level2.traversal.NodeFiler;
|
||||
|
||||
// Export
|
||||
module.exports.dom = {
|
||||
level3 : {
|
||||
ls : ls
|
||||
}
|
||||
};
|
||||
|
1866
bower_components/jsdom/lib/jsdom/level3/xpath.js
vendored
1866
bower_components/jsdom/lib/jsdom/level3/xpath.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,39 +0,0 @@
|
||||
var nwmatcher = require("nwmatcher/src/nwmatcher-noqsa");
|
||||
|
||||
function addNwmatcher(document) {
|
||||
if (!document._nwmatcher) {
|
||||
document._nwmatcher = nwmatcher({ document: document });
|
||||
document._nwmatcher.configure({ UNIQUE_ID: false });
|
||||
}
|
||||
return document._nwmatcher;
|
||||
}
|
||||
|
||||
exports.applyQuerySelectorPrototype = function(dom) {
|
||||
dom.Document.prototype.querySelector = function(selector) {
|
||||
return addNwmatcher(this).first(selector, this);
|
||||
};
|
||||
|
||||
dom.Document.prototype.querySelectorAll = function(selector) {
|
||||
return new dom.NodeList(addNwmatcher(this).select(selector, this));
|
||||
};
|
||||
|
||||
dom.DocumentFragment.prototype.querySelector = function(selector) {
|
||||
return addNwmatcher(this.ownerDocument).first(selector, this);
|
||||
};
|
||||
|
||||
dom.DocumentFragment.prototype.querySelectorAll = function(selector) {
|
||||
return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this));
|
||||
};
|
||||
|
||||
dom.Element.prototype.querySelector = function(selector) {
|
||||
return addNwmatcher(this.ownerDocument).first(selector, this);
|
||||
};
|
||||
|
||||
dom.Element.prototype.querySelectorAll = function(selector) {
|
||||
return new dom.NodeList(addNwmatcher(this.ownerDocument).select(selector, this));
|
||||
};
|
||||
|
||||
dom.Element.prototype.matchesSelector = function(selector) {
|
||||
return addNwmatcher(this.ownerDocument).match(this, selector);
|
||||
};
|
||||
};
|
121
bower_components/jsdom/lib/jsdom/utils.js
vendored
121
bower_components/jsdom/lib/jsdom/utils.js
vendored
@ -1,121 +0,0 @@
|
||||
var path = require('path');
|
||||
|
||||
/**
|
||||
* Intercepts a method by replacing the prototype's implementation
|
||||
* with a wrapper that invokes the given interceptor instead.
|
||||
*
|
||||
* utils.intercept(core.Element, 'inserBefore',
|
||||
* function(_super, args, newChild, refChild) {
|
||||
* console.log('insertBefore', newChild, refChild);
|
||||
* return _super.apply(this, args);
|
||||
* }
|
||||
* );
|
||||
*/
|
||||
exports.intercept = function(clazz, method, interceptor) {
|
||||
var proto = clazz.prototype,
|
||||
_super = proto[method],
|
||||
unwrapArgs = interceptor.length > 2;
|
||||
|
||||
proto[method] = function() {
|
||||
if (unwrapArgs) {
|
||||
var args = Array.prototype.slice.call(arguments);
|
||||
args.unshift(_super, arguments);
|
||||
return interceptor.apply(this, args);
|
||||
}
|
||||
else {
|
||||
return interceptor.call(this, _super, arguments);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
exports.toFileUrl = function (fileName) {
|
||||
// Beyond just the `path.resolve`, this is mostly for the benefit of Windows,
|
||||
// where we need to convert '\' to '/' and add an extra '/' prefix before the
|
||||
// drive letter.
|
||||
var pathname = path.resolve(process.cwd(), fileName).replace(/\\/g, '/');
|
||||
if (pathname[0] !== '/') {
|
||||
pathname = '/' + pathname;
|
||||
}
|
||||
|
||||
return 'file://' + pathname;
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a setter on an object
|
||||
*
|
||||
* This method replaces any existing setter but leaves getters in place.
|
||||
*
|
||||
* - `object` {Object} the object to define the setter on
|
||||
* - `property` {String} the name of the setter
|
||||
* - `setterFn` {Function} the setter
|
||||
*/
|
||||
exports.defineSetter = function defineSetter(object, property, setterFn) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(object, property) || {
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
};
|
||||
|
||||
descriptor.set = setterFn;
|
||||
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
};
|
||||
|
||||
/**
|
||||
* Define a getter on an object
|
||||
*
|
||||
* This method replaces any existing getter but leaves setters in place.
|
||||
*
|
||||
* - `object` {Object} the object to define the getter on
|
||||
* - `property` {String} the name of the getter
|
||||
* - `getterFn` {Function} the getter
|
||||
*/
|
||||
exports.defineGetter = function defineGetter(object, property, getterFn) {
|
||||
var descriptor = Object.getOwnPropertyDescriptor(object, property) || {
|
||||
configurable: true,
|
||||
enumerable: true
|
||||
};
|
||||
|
||||
descriptor.get = getterFn;
|
||||
|
||||
Object.defineProperty(object, property, descriptor);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an object with the given prototype
|
||||
*
|
||||
* Optionally augment the created object.
|
||||
*
|
||||
* - `prototyp` {Object} the created object's prototype
|
||||
* - `[properties]` {Object} properties to attach to the created object
|
||||
*/
|
||||
exports.createFrom = function createFrom(prototype, properties) {
|
||||
properties = properties || {};
|
||||
|
||||
var descriptors = {};
|
||||
Object.getOwnPropertyNames(properties).forEach(function (name) {
|
||||
descriptors[name] = Object.getOwnPropertyDescriptor(properties, name);
|
||||
});
|
||||
|
||||
return Object.create(prototype, descriptors);
|
||||
};
|
||||
|
||||
/**
|
||||
* Create an inheritance relationship between two classes
|
||||
*
|
||||
* Optionally augment the inherited prototype.
|
||||
*
|
||||
* - `Superclass` {Function} the inherited class
|
||||
* - `Subclass` {Function} the inheriting class
|
||||
* - `[properties]` {Object} properties to attach to the inherited prototype
|
||||
*/
|
||||
exports.inheritFrom = function inheritFrom(Superclass, Subclass, properties) {
|
||||
properties = properties || {};
|
||||
|
||||
Object.defineProperty(properties, 'constructor', {
|
||||
value: Subclass,
|
||||
writable: true,
|
||||
configurable: true
|
||||
});
|
||||
|
||||
Subclass.prototype = exports.createFrom(Superclass.prototype, properties);
|
||||
};
|
77
bower_components/jsdom/package.json
vendored
77
bower_components/jsdom/package.json
vendored
@ -1,77 +0,0 @@
|
||||
{
|
||||
"name": "jsdom",
|
||||
"version": "0.10.6",
|
||||
"description": "A JavaScript implementation of the DOM and HTML standards",
|
||||
"keywords": ["dom", "html", "whatwg", "w3c"],
|
||||
"maintainers": [
|
||||
"Elijah Insua <tmpvar@gmail.com> (http://tmpvar.com)",
|
||||
"Domenic Denicola <domenic@domenicdenicola.com (http://domenic.me/)"
|
||||
],
|
||||
"contributors": [
|
||||
"Vincent Greene <ulteriorlife@gmail.com>",
|
||||
"Dav Glass <davglass@gmail.com>",
|
||||
"Felix Gnass <fgnass@gmail.com>",
|
||||
"Charlie Robbins <charlie.robbins@gmail.com>",
|
||||
"Aria Stewart <aredridel@nbtsc.org>",
|
||||
"Matthew <N.A.> (http://github.com/matthewpflueger/)",
|
||||
"Olivier El Mekki <unknown> (http://blog.olivier-elmekki.com/)",
|
||||
"Shimon Dookdin <helpmepro1@gmail.com>",
|
||||
"Daniel Cassidy <mail@danielcassidy.me.uk> (http://www.danielcassidy.me.uk/)",
|
||||
"Sam Ruby (http://intertwingly.net/blog/)",
|
||||
"hij1nx (http://github.com/hij1nx)",
|
||||
"Yonathan Randolph (http://github.com/yonran)",
|
||||
"Martin Davis (http://github.com/waslogic)",
|
||||
"Andreas Lind Petersen <andreas@one.com>",
|
||||
"d-ash (http://github.com/d-ash)",
|
||||
"Robin Zhong <fbzhong@gmail.com>",
|
||||
"Alexander Flatter <flatter@gmail.com>",
|
||||
"Heng Liu <liucougar@gmail.com>",
|
||||
"Brian McDaniel (http://github.com/brianmcd)",
|
||||
"John Hurliman <jhurliman@jhurliman.org>",
|
||||
"Jimmy Mabey",
|
||||
"Gregory Tomlinson",
|
||||
"Jason Davies (http://www.jasondavies.com/)",
|
||||
"Josh Marshall (http://www.ponderingtheobvious.com/)",
|
||||
"Jason Priestley (https://github.com/jhp)",
|
||||
"Derek Lindahl (https://github.com/dlindahl)",
|
||||
"Chris Roebuck <chris@quillu.com> (http://www.quillu.com)",
|
||||
"Avi Deitcher (https://github.com/deitch)",
|
||||
"Nao Iizuka <iizuka@kyu-mu.net> (https://github.com/iizukanao)",
|
||||
"Peter Perenyi (https://github.com/sinegar)",
|
||||
"Tiago Rodrigues <tmcrodrigues@gmail.com> (http://trodrigues.net)",
|
||||
"Samori Gorse <samorigorse@gmail.com> (http://github.com/shinuza)",
|
||||
"John Roberts <jroberts@logitech.com>",
|
||||
"Chad Walker <chad@chad-cat-lore-eddie.com> (https://github.com/chad3814)",
|
||||
"Zach Smith <x.coder.zach@gmail.com> (https://github.com/xcoderzach)"
|
||||
],
|
||||
"bugs": {
|
||||
"email": "tmpvar@gmail.com",
|
||||
"url": "http://github.com/tmpvar/jsdom/issues"
|
||||
},
|
||||
"license": {
|
||||
"type": "MIT",
|
||||
"url": "http://github.com/tmpvar/jsdom/blob/master/LICENSE.txt"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/tmpvar/jsdom.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"htmlparser2": ">= 3.1.5 <4",
|
||||
"nwmatcher": "~1.3.2",
|
||||
"request": "2.x",
|
||||
"xmlhttprequest": ">=1.5.0",
|
||||
"cssom": "~0.3.0",
|
||||
"cssstyle": "~0.2.9",
|
||||
"contextify": "~0.1.5"
|
||||
},
|
||||
"devDependencies" : {
|
||||
"nodeunit": "~0.8.0",
|
||||
"optimist": "*",
|
||||
"urlmaster": ">=0.2.15"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node ./test/runner"
|
||||
},
|
||||
"main": "./lib/jsdom"
|
||||
}
|
22
bower_components/jsdom/status.json
vendored
22
bower_components/jsdom/status.json
vendored
@ -1,22 +0,0 @@
|
||||
{
|
||||
"todo" : [
|
||||
"finish implementing window",
|
||||
"implement dom level3/core",
|
||||
"implement dom level3/ls"
|
||||
],
|
||||
"done" : [
|
||||
"consider a cleaner way to do 'private' variables - NO",
|
||||
"dom level2/html",
|
||||
"dom level2/core",
|
||||
"dom level2/events",
|
||||
"investigate merging upstream changes from HEAD with dav's node-htmlparser fork",
|
||||
"consider implementing HTML based elements in level1 - NO",
|
||||
"ensure doc.documentElement is updated in long living dom documents",
|
||||
"pass YUI3 dom and selector tests via browser augmentation",
|
||||
"move node-htmlparser dependence out into a utility area",
|
||||
"allow YUI3 to run on top of jsdom",
|
||||
"run sizzle and pure templating on node",
|
||||
"build browser compatibility layer",
|
||||
"build dom level 1"
|
||||
]
|
||||
}
|
279
bower_components/jsdom/test/DOMTestCase.js
vendored
279
bower_components/jsdom/test/DOMTestCase.js
vendored
@ -1,279 +0,0 @@
|
||||
/*
|
||||
Copyright (c) 2001-2004 World Wide Web Consortium,
|
||||
(Massachusetts Institute of Technology, Institut National de
|
||||
Recherche en Informatique et en Automatique, Keio University). All
|
||||
Rights Reserved. This program is distributed under the W3C's Software
|
||||
Intellectual Property License. This program is distributed in the
|
||||
hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
||||
PURPOSE.
|
||||
See W3C License http://www.w3.org/Consortium/Legal/ for more details.
|
||||
*/
|
||||
exports.assertSize = function(descr, expected, actual) {
|
||||
var actualSize;
|
||||
assertNotNull(descr, actual);
|
||||
actualSize = actual.length;
|
||||
assertEquals(descr, expected, actualSize);
|
||||
}
|
||||
|
||||
exports.assertEqualsAutoCase = function(context, descr, expected, actual) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if(context == "attribute") {
|
||||
assertEquals(descr, expected.toLowerCase(), actual.toLowerCase());
|
||||
} else {
|
||||
assertEquals(descr, expected.toUpperCase(), actual);
|
||||
}
|
||||
} else {
|
||||
assertEquals(descr, expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exports.assertEqualsCollectionAutoCase = function(context, descr, expected, actual) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
|
||||
//
|
||||
// if there length is the same, then every entry in the expected list
|
||||
// must appear once and only once in the actual list
|
||||
var expectedLen = expected.length;
|
||||
var expectedValue;
|
||||
var actualLen = actual.length;
|
||||
var i;
|
||||
var j;
|
||||
var matches;
|
||||
for(i = 0; i < expectedLen; i++) {
|
||||
matches = 0;
|
||||
expectedValue = expected[i];
|
||||
for(j = 0; j < actualLen; j++) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if (context == "attribute") {
|
||||
if (expectedValue.toLowerCase() == actual[j].toLowerCase()) {
|
||||
matches++;
|
||||
}
|
||||
} else {
|
||||
if (expectedValue.toUpperCase() == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(expectedValue == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(matches == 0) {
|
||||
throw new MjsUnitAssertionError(descr + ": No match found for " + expectedValue);
|
||||
}
|
||||
if(matches > 1) {
|
||||
throw new MjsUnitAssertionError(descr + ": Multiple matches found for " + expectedValue);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exports.assertEqualsCollection = function(test, expected, actual, descr) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
test.strictEqual(expected.length, actual.length, descr);
|
||||
//
|
||||
// if there length is the same, then every entry in the expected list
|
||||
// must appear once and only once in the actual list
|
||||
var expectedLen = expected.length;
|
||||
var expectedValue;
|
||||
var actualLen = actual.length;
|
||||
var i;
|
||||
var j;
|
||||
var matches;
|
||||
for(i = 0; i < expectedLen; i++) {
|
||||
matches = 0;
|
||||
expectedValue = expected[i];
|
||||
for(j = 0; j < actualLen; j++) {
|
||||
if(expectedValue == actual[j]) {
|
||||
matches++;
|
||||
}
|
||||
}
|
||||
test.ok(matches !== 0, 'No match found for ' + expectedValue);
|
||||
test.ok(matches < 2, 'To many matches found for ' + expectedValue);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
exports.assertEqualsListAutoCase = function(context, descr, expected, actual) {
|
||||
var minLength = expected.length;
|
||||
if (actual.length < minLength) {
|
||||
minLength = actual.length;
|
||||
}
|
||||
//
|
||||
for(var i = 0; i < minLength; i++) {
|
||||
assertEqualsAutoCase(context, descr, expected[i], actual[i]);
|
||||
}
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
assertEquals(descr, expected.length, actual.length);
|
||||
}
|
||||
|
||||
|
||||
exports.assertEqualsList = exports.arrayEqual = function(test, expected, actual) {
|
||||
//
|
||||
// if they aren't the same size, they aren't equal
|
||||
test.equal(expected.length, actual.length, "Array lengths are not the same!");
|
||||
|
||||
var minLength = expected.length;
|
||||
if (actual.length < minLength) {
|
||||
minLength = actual.length;
|
||||
}
|
||||
|
||||
//
|
||||
for(var i = 0; i < minLength; i++) {
|
||||
test.ok(expected[i] === actual[i], "Arrays not equal!" + expected[i] + ' vs ' + actual[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.assertInstanceOf = function(descr, type, obj) {
|
||||
if(type == "Attr") {
|
||||
assertEquals(descr,2,obj.nodeType);
|
||||
var specd = obj.specified;
|
||||
}
|
||||
}
|
||||
|
||||
exports.assertSame = function(descr, expected, actual) {
|
||||
if(expected != actual) {
|
||||
assertEquals(descr, expected.nodeType, actual.nodeType);
|
||||
assertEquals(descr, expected.nodeValue, actual.nodeValue);
|
||||
}
|
||||
}
|
||||
|
||||
exports.assertURIEquals = function(assertID, scheme, path, host, file, name, query, fragment, isAbsolute, actual) {
|
||||
//
|
||||
// URI must be non-null
|
||||
assertNotNull(assertID, actual);
|
||||
|
||||
var uri = actual;
|
||||
|
||||
var lastPound = actual.lastIndexOf("#");
|
||||
var actualFragment = "";
|
||||
if(lastPound != -1) {
|
||||
//
|
||||
// substring before pound
|
||||
//
|
||||
uri = actual.substring(0,lastPound);
|
||||
actualFragment = actual.substring(lastPound+1);
|
||||
}
|
||||
if(fragment != null) assertEquals(assertID,fragment, actualFragment);
|
||||
|
||||
var lastQuestion = uri.lastIndexOf("?");
|
||||
var actualQuery = "";
|
||||
if(lastQuestion != -1) {
|
||||
//
|
||||
// substring before pound
|
||||
//
|
||||
uri = actual.substring(0,lastQuestion);
|
||||
actualQuery = actual.substring(lastQuestion+1);
|
||||
}
|
||||
if(query != null) assertEquals(assertID, query, actualQuery);
|
||||
|
||||
var firstColon = uri.indexOf(":");
|
||||
var firstSlash = uri.indexOf("/");
|
||||
var actualPath = uri;
|
||||
var actualScheme = "";
|
||||
if(firstColon != -1 && firstColon < firstSlash) {
|
||||
actualScheme = uri.substring(0,firstColon);
|
||||
actualPath = uri.substring(firstColon + 1);
|
||||
}
|
||||
|
||||
if(scheme != null) {
|
||||
assertEquals(assertID, scheme, actualScheme);
|
||||
}
|
||||
|
||||
if(path != null) {
|
||||
assertEquals(assertID, path, actualPath);
|
||||
}
|
||||
|
||||
if(host != null) {
|
||||
var actualHost = "";
|
||||
if(actualPath.substring(0,2) == "//") {
|
||||
var termSlash = actualPath.substring(2).indexOf("/") + 2;
|
||||
actualHost = actualPath.substring(0,termSlash);
|
||||
}
|
||||
assertEquals(assertID, host, actualHost);
|
||||
}
|
||||
|
||||
if(file != null || name != null) {
|
||||
var actualFile = actualPath;
|
||||
var finalSlash = actualPath.lastIndexOf("/");
|
||||
if(finalSlash != -1) {
|
||||
actualFile = actualPath.substring(finalSlash+1);
|
||||
}
|
||||
if (file != null) {
|
||||
assertEquals(assertID, file, actualFile);
|
||||
}
|
||||
if (name != null) {
|
||||
var actualName = actualFile;
|
||||
var finalDot = actualFile.lastIndexOf(".");
|
||||
if (finalDot != -1) {
|
||||
actualName = actualName.substring(0, finalDot);
|
||||
}
|
||||
assertEquals(assertID, name, actualName);
|
||||
}
|
||||
}
|
||||
|
||||
if(isAbsolute != null) {
|
||||
assertEquals(assertID, isAbsolute, actualPath.substring(0,1) == "/");
|
||||
}
|
||||
}
|
||||
|
||||
// size() used by assertSize element
|
||||
function size(collection)
|
||||
{
|
||||
return collection.length;
|
||||
}
|
||||
|
||||
function same(expected, actual)
|
||||
{
|
||||
return expected === actual;
|
||||
}
|
||||
|
||||
function getSuffix(contentType) {
|
||||
switch(contentType) {
|
||||
case "text/html":
|
||||
return ".html";
|
||||
|
||||
case "text/xml":
|
||||
return ".xml";
|
||||
|
||||
case "application/xhtml+xml":
|
||||
return ".xhtml";
|
||||
|
||||
case "image/svg+xml":
|
||||
return ".svg";
|
||||
|
||||
case "text/mathml":
|
||||
return ".mml";
|
||||
}
|
||||
return ".html";
|
||||
}
|
||||
|
||||
exports.toLowerArray = function(src) {
|
||||
var newArray = new Array();
|
||||
var i;
|
||||
for (i = 0; i < src.length; i++) {
|
||||
newArray[i] = src[i].toLowerCase();
|
||||
}
|
||||
return newArray;
|
||||
}
|
||||
|
||||
|
||||
|
||||
exports.equalsAutoCase = function(context, expected, actual) {
|
||||
if (builder.contentType == "text/html") {
|
||||
if (context == "attribute") {
|
||||
return expected.toLowerCase() == actual;
|
||||
}
|
||||
return expected.toUpperCase() == actual;
|
||||
}
|
||||
return expected == actual;
|
||||
}
|
||||
|
||||
|
4
bower_components/jsdom/test/LICENSE.txt
vendored
4
bower_components/jsdom/test/LICENSE.txt
vendored
@ -1,4 +0,0 @@
|
||||
all level1,level2,level3 test cases were written by the w3c
|
||||
see: http://www.w3.org/Consortium/Legal/2008/04-testsuite-copyright.html for licensing
|
||||
|
||||
all other folders in this directory follow the same license as ../LICENSE.txt
|
31
bower_components/jsdom/test/all.js
vendored
31
bower_components/jsdom/test/all.js
vendored
@ -1,31 +0,0 @@
|
||||
var path = require('path');
|
||||
var r = function(suite) {
|
||||
return require(path.join(__dirname, suite))
|
||||
}
|
||||
|
||||
var fetch = [
|
||||
"level1/core",
|
||||
"level1/html",
|
||||
"level1/svg",
|
||||
"level2/core",
|
||||
"level2/html",
|
||||
"level2/style",
|
||||
"level2/extra",
|
||||
"level3/core",
|
||||
"level3/ls",
|
||||
"level3/xpath",
|
||||
/*
|
||||
TODO: this needs work, will break everything if included.
|
||||
"window",*/
|
||||
"jsdom",
|
||||
"sizzle"
|
||||
];
|
||||
|
||||
module.exports = {};
|
||||
|
||||
|
||||
// TODO: filtering
|
||||
fetch.forEach(function(k) {
|
||||
module.exports[k] = r(k);
|
||||
});
|
||||
|
13
bower_components/jsdom/test/browser/css.js
vendored
13
bower_components/jsdom/test/browser/css.js
vendored
@ -1,13 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var jsdom = require("../..").jsdom;
|
||||
|
||||
exports["should not give CSS parsing errors upon encountering @-moz-document (GH-687)"] = function (t) {
|
||||
var css = ".x @-moz-document url-prefix() { .y { color: blue; } }";
|
||||
var html = "<!DOCTYPE html><html><head><style>" + css + "</style></head><body><p>Hi</p></body></html>";
|
||||
|
||||
jsdom.env({ html: html, done: function (errors, window) {
|
||||
t.strictEqual(errors, null);
|
||||
t.done();
|
||||
} });
|
||||
};
|
252
bower_components/jsdom/test/browser/files/site.html
vendored
252
bower_components/jsdom/test/browser/files/site.html
vendored
@ -1,252 +0,0 @@
|
||||
|
||||
<!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" xml:lang="en" lang="en">
|
||||
<head>
|
||||
<title>Site</title>
|
||||
<script type="text/javascript" src="../../jquery-fixtures/jquery-1.4.2.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
|
||||
<div id="header">
|
||||
<a href="" id="logo"><img src="images/header.png" alt="header image" /></a>
|
||||
<div id="links">
|
||||
<a href="http://twitter.com/stevelacey" rel="external"><img src="images/header/twitter.png" alt="Follow me on Twitter." title="Follow me on Twitter." /></a>
|
||||
<a href="http://www.flickr.com/photos/stevelacey" rel="external"><img src="images/header/flickr.png" alt="View my Flickr Photostream." title="View my Flickr Photostream." /></a>
|
||||
<a href="http://www.last.fm/user/Steve-UK" rel="external"><img src="images/header/last.fm.png" alt="See my Music Profile on Last.fm." title="See my Music Profile on Last.fm." /></a>
|
||||
<a href="rss"><img src="images/header/rss.png" alt="Subscribe to my RSS Feed." title="Subscribe to my RSS Feed." /></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="nav">
|
||||
<ul>
|
||||
<li><a href="">Home</a></li>
|
||||
<li><a href="portfolio">Portfolio</a></li>
|
||||
<li><a href="dev">Development</a></li>
|
||||
<li><a href="pal"><acronym title="Peer Assisted Learning">PAL</acronym></a></li>
|
||||
<li><a href="about">About</a></li>
|
||||
<li><a href="contact">Contact</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="content">
|
||||
|
||||
<div id="column1">
|
||||
|
||||
<div id="blog" class="blog_item">
|
||||
|
||||
<div class="post">
|
||||
<h1><a href="blog/6">Spotify</a></h1>
|
||||
<div class="date">Sunday 8th February 09</div>
|
||||
<div class="article">
|
||||
Never download music again!.. or at least that's what I'm going to do. It's not often I come across an application that changes the way I live as dramatically as Spotify does.<br /><br />
|
||||
Spotify is basically a streaming application, but different to any I've ever seen before. Their database contains a massive selection of songs, all of which are available to you at the click of a mouse. The quality of the service is so extraordinary you won't even notice a delay, the bitrate of the music streamed is around 160kbps and I challenge anyone to notice any difference to playing music...
|
||||
</div>
|
||||
<div class="comments">
|
||||
<div><span class="time">Posted by Steve at 11:45am.</span></div>
|
||||
<div class="right"><a href="blog/6#comments">Comments (7)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post">
|
||||
<h1><a href="blog/5">Christmas PAL Session</a></h1>
|
||||
<div class="date">Monday 15th December 08</div>
|
||||
<div class="article">
|
||||
It's the last session before Christmas, as part of the festive cheer I have hidden 7 Santa's and a Snowman on my site.<br /><br />
|
||||
Whoever spots them all and post there location as a comment on this post first wins a box of celebrations!<br /><br />
|
||||
(The Santa on this post doesn't count!)<br /><br />
|
||||
Good Luck!
|
||||
|
||||
</div>
|
||||
<div class="comments">
|
||||
<div><span class="time">Posted by Steve at 7:39am.</span></div>
|
||||
<div class="right"><a href="blog/5#comments">Comments (3)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post">
|
||||
<h1><a href="blog/4">Stockazon</a></h1>
|
||||
<div class="date">Friday 15th August 08</div>
|
||||
<div class="article">
|
||||
It's been a long time since my last article, so I thought I'd post a quick update. A few weeks ago I was approached by a developer I've known for a few years who wanted me to design a new website for his next project 'Stockazon'.<br /><br />
|
||||
The concept is basically for a website that distributes SMS text messages to users alerting them when new stock arrives in on Amazon items that they're watching. Users can buy 'credits' from Stockazon via PayPal and search and add items to their basket via the website.<br /><br />
|
||||
The website is still very much in development but you...
|
||||
</div>
|
||||
<div class="comments">
|
||||
<div><span class="time">Posted by Steve at 9:18am.</span></div>
|
||||
<div class="right"><a href="blog/4#comments">Comments (0)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post">
|
||||
<h1><a href="blog/3">BBC Website Overspend</a></h1>
|
||||
<div class="date">Monday 2nd June 08</div>
|
||||
<div class="article">
|
||||
In the news this week is the apparent overspend by the BBC on the development of their new website.<br /><br />
|
||||
Now I would certainly not be the first to acknowledge that the new website is the pinnacle of what we as developers look for in modern web design, pretty much everything about it is fantastic. But should it have really cost £85.1 million to do it?<br /><br />
|
||||
There are many reports in the tabloids at the moment claiming the BBC overspent by as much as £36 million (Source: The Guardian); however the figure I'm more likely to be convinced by is what was stated...
|
||||
</div>
|
||||
<div class="comments">
|
||||
<div><span class="time">Posted by Steve at 8:53am.</span></div>
|
||||
<div class="right"><a href="blog/3#comments">Comments (1)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="post">
|
||||
<h1><a href="blog/2">The Planet</a></h1>
|
||||
<div class="date">Monday 2nd June 08</div>
|
||||
<div class="article">
|
||||
Apologies for the downtime of the site over the last couple of days; it was caused by an explosion in Houston, Texas at ThePlanet.com's datacentre which knocked out over 9000 websites including my own. It took me a while to establish what had caused the problem, mainly because I'm down a hierarchy of 2 other companies before I get to ThePlanet (SureSpace.net that purchases reseller hosting from HostNine.com who rent space from ThePlanet.com).<br /><br />
|
||||
The explosion was caused by an electrical fire in one of the rooms of the facility, the blast was powerful enough to take down 3 walls in an...
|
||||
</div>
|
||||
<div class="comments">
|
||||
<div><span class="time">Posted by Steve at 8:29am.</span></div>
|
||||
<div class="right"><a href="blog/2#comments">Comments (0)</a></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="column2">
|
||||
|
||||
<div id="status" class="blog_item">
|
||||
<h2>Tweet tweet</h2>
|
||||
<span>
|
||||
<a href="http://twitter.com/stevelacey" rel="external">stevelacey</a>: RT <a rel="external" href="http://twitter.com/iamdanw">@iamdanw</a>: Levelling up my apostrophe skills <a rel="external" href="http://j.mp/bifO0Z">http://j.mp/bifO0Z</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="archive" class="blog_item">
|
||||
<h2>Archive</h2>
|
||||
<a href="rss" class="icon"><img src="images/icons/rss.gif" alt="Subscribe to the Blog's RSS Feed" title="Subscribe to the Blog's RSS Feed" /></a>
|
||||
<ul>
|
||||
|
||||
<li>
|
||||
<span class="month">February 09</span>
|
||||
<ul>
|
||||
<li><a href="blog/6">Spotify</a> <a href="blog/6#comments">(7)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="month">December 08</span>
|
||||
<ul>
|
||||
<li><a href="blog/5">Christmas PAL Session</a> <a href="blog/5#comments">(3)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="month">August 08</span>
|
||||
<ul>
|
||||
<li><a href="blog/4">Stockazon</a> <a href="blog/4#comments">(0)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="month">June 08</span>
|
||||
<ul>
|
||||
<li><a href="blog/3">BBC Website Overspend</a> <a href="blog/3#comments">(1)</a></li>
|
||||
<li><a href="blog/2">The Planet</a> <a href="blog/2#comments">(0)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li>
|
||||
<span class="month">May 08</span>
|
||||
<ul>
|
||||
<li><a href="blog/1">Save the Developers</a> <a href="blog/1#comments">(3)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div id="lastfm" class="blog_item">
|
||||
<h2><a href="http://www.last.fm/user/Steve-UK" rel="external">Just Listened</a></h2>
|
||||
<a onclick="slide('#music_expand')" id="lastfm_arrow" class="arrow icon"></a>
|
||||
<div id="music">
|
||||
|
||||
<a href="http://www.last.fm/music/Razorlight/_/Fall%2C+Fall%2C+Fall" class="track" rel="external">
|
||||
<img src="http://userserve-ak.last.fm/serve/64s/53726057.jpg" class="cover" alt="Razorlight - Fall, Fall, Fall" title="Razorlight - Fall, Fall, Fall" />
|
||||
<span class="song">Razorlight - Fall, Fall, Fall</span>
|
||||
<span class="album">Up All Night</span>
|
||||
<span class="time">Yesterday at 11:18pm</span>
|
||||
</a>
|
||||
|
||||
<a href="http://www.last.fm/music/Razorlight/_/Stumble+And+Fall" class="track" rel="external">
|
||||
<img src="http://userserve-ak.last.fm/serve/64s/53726057.jpg" class="cover" alt="Razorlight - Stumble And Fall" title="Razorlight - Stumble And Fall" />
|
||||
<span class="song">Razorlight - Stumble And Fall</span>
|
||||
<span class="album">Up All Night</span>
|
||||
<span class="time">Yesterday at 11:15pm</span>
|
||||
</a>
|
||||
|
||||
<a href="http://www.last.fm/music/Radiohead/_/Like+Spinning+Plates" class="track" rel="external">
|
||||
<img src="http://userserve-ak.last.fm/serve/64s/52753499.png" class="cover" alt="Radiohead - Like Spinning Plates" title="Radiohead - Like Spinning Plates" />
|
||||
<span class="song">Radiohead - Like Spinning Plates</span>
|
||||
<span class="album">Amnesiac</span>
|
||||
<span class="time">Yesterday at 11:11pm</span>
|
||||
</a>
|
||||
|
||||
<div id="music_expand">
|
||||
|
||||
<a href="http://www.last.fm/music/Massive+Attack/_/Hymn+of+the+Big+Wheel" class="track" rel="external">
|
||||
<img src="http://userserve-ak.last.fm/serve/64s/47527219.png" class="cover" alt="Massive Attack - Hymn of the Big Wheel" title="Massive Attack - Hymn of the Big Wheel" />
|
||||
<span class="song">Massive Attack - Hymn of the Big Wheel</span>
|
||||
<span class="album">Blue Lines</span>
|
||||
<span class="time">Yesterday at 11:04pm</span>
|
||||
</a>
|
||||
|
||||
<a href="http://www.last.fm/music/The+Killers/_/Everything+Will+Be+Alright" class="track" rel="external">
|
||||
<img src="http://userserve-ak.last.fm/serve/64s/39551741.png" class="cover" alt="The Killers - Everything Will Be Alright" title="The Killers - Everything Will Be Alright" />
|
||||
<span class="song">The Killers - Everything Will Be Alright</span>
|
||||
<span class="album">Hot Fuss</span>
|
||||
<span class="time">Yesterday at 10:58pm</span>
|
||||
</a>
|
||||
|
||||
<a href="http://www.last.fm/music/Jet/_/Hey+Kids+-+Digital+Album+Version" class="track" rel="external">
|
||||
<img src="images/unknown.png" class="cover" alt="Jet - Hey Kids - Digital Album Version" title="Jet - Hey Kids - Digital Album Version" />
|
||||
<span class="song">Jet - Hey Kids - Digital Album Version</span>
|
||||
<span class="album"></span>
|
||||
<span class="time">Yesterday at 10:55pm</span>
|
||||
</a>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="flickr" class="blog_item">
|
||||
<h2><a href="http://www.flickr.com/photos/stevelacey" rel="external">Recent Photos</a></h2>
|
||||
<a onclick="slide('#photo_expand')" id="flickr_arrow" class="arrow icon"></a>
|
||||
<div class="inner">
|
||||
<a href="http://farm5.static.flickr.com/4125/5173546396_cb3a27abd8.jpg" class="lightbox" title="CXPartners Eye Tracking"><img src="http://farm5.static.flickr.com/4125/5173546396_cb3a27abd8_s.jpg" alt="CXPartners Eye Tracking" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4085/5172882321_a6afb748ec.jpg" class="lightbox" title="CXPartners Eye Tracking"><img src="http://farm5.static.flickr.com/4085/5172882321_a6afb748ec_s.jpg" alt="CXPartners Eye Tracking" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4092/5173477840_fcfaa0c048.jpg" class="lightbox" title="CXPartners Eye Tracking Heatmap National Rail"><img src="http://farm5.static.flickr.com/4092/5173477840_fcfaa0c048_s.jpg" alt="CXPartners Eye Tracking Heatmap National Rail" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4126/5172868015_06d8ba3daa.jpg" class="lightbox" title="CXPartners Eye Tracking National Rail"><img src="http://farm5.static.flickr.com/4126/5172868015_06d8ba3daa_s.jpg" alt="CXPartners Eye Tracking National Rail" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4088/5173439086_776294f1ee.jpg" class="lightbox" title="CXPartners Eye Tracking Google"><img src="http://farm5.static.flickr.com/4088/5173439086_776294f1ee_s.jpg" alt="CXPartners Eye Tracking Google" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4023/5161805610_e0c4341490.jpg" class="lightbox" title="Outdoor AR Drone at Bathcamp"><img src="http://farm5.static.flickr.com/4023/5161805610_e0c4341490_s.jpg" alt="Outdoor AR Drone at Bathcamp" /></a>
|
||||
|
||||
<div id="photo_expand">
|
||||
<a href="http://farm5.static.flickr.com/4153/5161182951_192b57e05d.jpg" class="lightbox" title="Outdoor AR Drone at Bathcamp"><img src="http://farm5.static.flickr.com/4153/5161182951_192b57e05d_s.jpg" alt="Outdoor AR Drone at Bathcamp" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4087/5161141625_730b3c2fe2.jpg" class="lightbox" title="AR Drone RFID Challenge at Bathcamp"><img src="http://farm5.static.flickr.com/4087/5161141625_730b3c2fe2_s.jpg" alt="AR Drone RFID Challenge at Bathcamp" /></a>
|
||||
<a href="http://farm2.static.flickr.com/1350/5161712508_3b830b70fe.jpg" class="lightbox" title="AR Drone RFID Challenge at Bathcamp"><img src="http://farm2.static.flickr.com/1350/5161712508_3b830b70fe_s.jpg" alt="AR Drone RFID Challenge at Bathcamp" /></a>
|
||||
<a href="http://farm2.static.flickr.com/1434/5161686696_1b498f32fe.jpg" class="lightbox" title="AR Drone at Bathcamp"><img src="http://farm2.static.flickr.com/1434/5161686696_1b498f32fe_s.jpg" alt="AR Drone at Bathcamp" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4126/5161647336_f2c910f14b.jpg" class="lightbox" title="AR Drone at Bathcamp"><img src="http://farm5.static.flickr.com/4126/5161647336_f2c910f14b_s.jpg" alt="AR Drone at Bathcamp" /></a>
|
||||
<a href="http://farm5.static.flickr.com/4103/5161622938_48155c7ddd.jpg" class="lightbox" title="AR Drone at Bathcamp"><img src="http://farm5.static.flickr.com/4103/5161622938_48155c7ddd_s.jpg" alt="AR Drone at Bathcamp" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<div id="footer">
|
||||
<a href="http://www.mysql.com" id="roll1"></a>
|
||||
<a href="http://www.php.net" id="roll2"></a>
|
||||
<a href="http://validator.w3.org/check/referer" id="roll3"></a>
|
||||
<a href="http://jigsaw.w3.org/css-validator/check/referer" id="roll4"></a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
562
bower_components/jsdom/test/browser/index.js
vendored
562
bower_components/jsdom/test/browser/index.js
vendored
@ -1,562 +0,0 @@
|
||||
var dom = require("../../lib/jsdom/level2/core").dom.level2.core;
|
||||
var jsdom = require('../../lib/jsdom');
|
||||
var browser;
|
||||
|
||||
exports.tests = {
|
||||
setUp : function(done) {
|
||||
browser = require("../../lib/jsdom/browser/index").browserAugmentation(dom);
|
||||
done();
|
||||
},
|
||||
notfound_getelementsbyclassname: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
p.className = "unknown";
|
||||
body.appendChild(p);
|
||||
var elements = doc.getElementsByClassName("first-p");
|
||||
test.equal(elements.length, 0, "no results");
|
||||
test.done();
|
||||
},
|
||||
|
||||
basic_getelementsbyclassname: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
p.className = "first-p";
|
||||
body.appendChild(p);
|
||||
var elements = doc.getElementsByClassName("first-p");
|
||||
test.equal(elements.item(0), p, 'p and first-p');
|
||||
test.done();
|
||||
},
|
||||
|
||||
multiple_getelementsbyclassname: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
p.className = "first-p second third";
|
||||
body.appendChild(p);
|
||||
var first = doc.getElementsByClassName("first-p").item(0);
|
||||
var second = doc.getElementsByClassName("second").item(0);
|
||||
var third = doc.getElementsByClassName("third").item(0);
|
||||
test.equal(first, p, 'p and first-p');
|
||||
test.equal(second, p, 'p and second');
|
||||
test.equal(third, p, 'p and third');
|
||||
test.done();
|
||||
},
|
||||
|
||||
testclassnameworksasexpected: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var p = doc.createElement("p");
|
||||
p.setAttribute("class", "first-p");
|
||||
test.equal(p.className, 'first-p', 'class attribute is same as className');
|
||||
p.className += " second";
|
||||
test.equal(p.className, 'first-p second', 'className getter/setter');
|
||||
test.done();
|
||||
},
|
||||
|
||||
basic_getelementbyid: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
p.id = "theid";
|
||||
body.appendChild(p);
|
||||
var element = doc.getElementById("theid");
|
||||
test.equal(element, p, "p and #theid");
|
||||
test.done();
|
||||
},
|
||||
|
||||
nonexistant_getelementbyid: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
p.id = "theid";
|
||||
body.appendChild(p);
|
||||
var element = doc.getElementById("non-existant-id");
|
||||
test.equal(element, null, "p and #theid");
|
||||
test.done();
|
||||
},
|
||||
|
||||
remove_nonexistantattribute: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
test.doesNotThrow(function(){ body.removeAttribute("non-existant"); }), 'setValue_throws_NO_MODIFICATION_ERR';
|
||||
test.done();
|
||||
},
|
||||
|
||||
render_singletag: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var p = doc.createElement("p");
|
||||
var img = doc.createElement("img");
|
||||
p.appendChild(img);
|
||||
var out = p.outerHTML;
|
||||
test.equal(out.match(/<\/img>/), null, 'end tag not included in output')
|
||||
test.done();
|
||||
},
|
||||
|
||||
render_specialchars: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var p = doc.createElement("p");
|
||||
var specials = '"<>&\xA0';
|
||||
var escapedSpecials = '"<>& ';
|
||||
p.setAttribute("specials", specials);
|
||||
p.innerHTML = escapedSpecials;
|
||||
var pp = doc.createElement("p");
|
||||
pp.appendChild(p);
|
||||
// This matches the behavior of FireFox, Chrome, and Safari.
|
||||
// IE8 does not escape <> in attributes, but does escape ­ in attributes and text content.
|
||||
test.equal(pp.innerHTML, '<p specials=""<>& ">"<>& </p>' );
|
||||
test.done();
|
||||
},
|
||||
|
||||
parse_scripttags: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var head = doc.createElement("head");
|
||||
var scriptHtml = '<script>alert("hello world")</script>';
|
||||
head.innerHTML = scriptHtml;
|
||||
test.equal(scriptHtml, head.innerHTML, "original and processed");
|
||||
test.done();
|
||||
},
|
||||
|
||||
parse_styletags: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var head = doc.createElement("head");
|
||||
var styleHtml = '<style>body: {color: #fff;}</style>';
|
||||
head.innerHTML = styleHtml;
|
||||
test.equal(styleHtml, head.innerHTML, "original and processed");
|
||||
test.done();
|
||||
},
|
||||
|
||||
parse_doublespacetags: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = '<html><body class="testing" /></html>';
|
||||
test.doesNotThrow(function(){ doc.innerHTML = html; }), 'setValue_throws_INVALID_CHARACTER_ERR';
|
||||
test.done();
|
||||
},
|
||||
|
||||
serialize_styleattribute: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var domToHtml = require('../../lib/jsdom/browser/domtohtml');
|
||||
doc.appendChild(doc.createElement('html'));
|
||||
doc.documentElement.style.color = 'black';
|
||||
doc.documentElement.style.backgroundColor = 'white';
|
||||
test.equal(domToHtml.domToHtml(doc), '<html style="color: black; background-color: white;"></html>\n', '');
|
||||
test.done();
|
||||
},
|
||||
|
||||
innerhtml_removeallchildren: function(test) {
|
||||
var doc = new browser.Document();
|
||||
var body = doc.createElement('body');
|
||||
body.appendChild(doc.createElement('p'));
|
||||
body.innerHTML = "";
|
||||
test.equal(body.childNodes.length, 0, 'still has children');
|
||||
test.done();
|
||||
},
|
||||
|
||||
innerhtml_null: function(test) {
|
||||
var doc = new browser.HTMLDocument();
|
||||
var body = doc.createElement('body');
|
||||
body.appendChild(doc.createElement('p'));
|
||||
body.innerHTML = null;
|
||||
test.equal(body.childNodes.length, 0, 'still has children');
|
||||
test.done();
|
||||
},
|
||||
|
||||
serialize_html5_doctype: function(test) {
|
||||
var dom = new browser.DOMImplementation();
|
||||
var doctype = dom.createDocumentType('html');
|
||||
var document = dom.createDocument(null, null, doctype);
|
||||
var regexp = /^\s*<!DOCTYPE html>/;
|
||||
test.ok(regexp.test(document.outerHTML), 'HTML 5 doctype did not serialize correctly');
|
||||
test.done();
|
||||
},
|
||||
|
||||
serialize_html4_strict_doctype: function(test) {
|
||||
var dom = new browser.DOMImplementation();
|
||||
var doctype = dom.createDocumentType('html', '-//W3C//DTD HTML 4.01//EN', 'http://www.w3.org/TR/html4/strict.dtd');
|
||||
var document = dom.createDocument(null, null, doctype);
|
||||
var regexp = /^\s*<!DOCTYPE html PUBLIC "-\/\/W3C\/\/DTD HTML 4.01\/\/EN" "http:\/\/www.w3.org\/TR\/html4\/strict.dtd">/;
|
||||
test.ok(regexp.test(document.outerHTML), 'HTML 4 strict doctype did not serialize correctly');
|
||||
test.done();
|
||||
},
|
||||
|
||||
serialize_system_doctype: function(test) {
|
||||
var dom = new browser.DOMImplementation();
|
||||
var doctype = dom.createDocumentType('foo', null, 'foo.dtd');
|
||||
var document = dom.createDocument(null, null, doctype);
|
||||
var regexp = /^\s*<!DOCTYPE foo SYSTEM "foo.dtd">/;
|
||||
test.ok(regexp.test(document.outerHTML), 'Doctype did not serialize correctly');
|
||||
test.done();
|
||||
},
|
||||
|
||||
serialize_doctype_containing_quotes: function(test) {
|
||||
var dom = new browser.DOMImplementation();
|
||||
var doctype = dom.createDocumentType('foo', null, 'foo "bar".dtd');
|
||||
var document = dom.createDocument(null, null, doctype);
|
||||
var regexp = /^\s*<!DOCTYPE foo SYSTEM \'foo "bar".dtd\'>/;
|
||||
test.ok(regexp.test(document.outerHTML), 'Doctype did not serialize correctly');
|
||||
test.done();
|
||||
},
|
||||
|
||||
parse_doctype_containing_newline : function(test) {
|
||||
var html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"\n \
|
||||
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">\n<html></html>',
|
||||
doc = new browser.Document();
|
||||
doc.innerHTML = html;
|
||||
test.ok(!!doc.doctype, 'doctype should not be falsy');
|
||||
test.done();
|
||||
},
|
||||
|
||||
basic_nodelist_indexOf : function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
body.appendChild(p);
|
||||
var div = doc.createElement("div");
|
||||
body.appendChild(div);
|
||||
var span = doc.createElement("span");
|
||||
body.appendChild(span);
|
||||
var index = body.childNodes._toArray().indexOf(span);
|
||||
test.equal(index, 2, "indexOf 'span' in childNodes")
|
||||
test.done();
|
||||
},
|
||||
|
||||
nonexistant_nodelist_indexOf : function(test) {
|
||||
var doc = new browser.Document();
|
||||
var html = doc.createElement("html");
|
||||
doc.appendChild(html);
|
||||
var body = doc.createElement("body");
|
||||
html.appendChild(body);
|
||||
var p = doc.createElement("p");
|
||||
body.appendChild(p);
|
||||
var div = doc.createElement("div");
|
||||
p.appendChild(div);
|
||||
var index = body.childNodes._toArray().indexOf(div);
|
||||
test.equal(index, -1, "indexOf 'span' in childNodes")
|
||||
test.done();
|
||||
},
|
||||
|
||||
input_fires_click_event : function(test) {
|
||||
doc = jsdom.jsdom(
|
||||
'<html><head></head><body>' +
|
||||
'<input type="checkbox" id="check" value="check" />' +
|
||||
'</body>')
|
||||
|
||||
var checkbox = doc.getElementById("check");
|
||||
|
||||
checkbox.addEventListener("click", function(event) {
|
||||
test.equal(event.type, "click", "event type");
|
||||
test.equal(event.target, checkbox, "event type");
|
||||
test.done();
|
||||
})
|
||||
|
||||
checkbox.click();
|
||||
},
|
||||
|
||||
basic_radio_selected : function(test) {
|
||||
doc = jsdom.jsdom(
|
||||
'<html><head></head><body>' +
|
||||
'<input type="radio" id="rad0" value="rad0" name="radioGroup0" />' +
|
||||
'<input type="radio" id="rad1" value="rad1" name="radioGroup0" checked="checked" />' +
|
||||
'<input type="radio" id="rad2" value="rad2" name="radioGroup1" />' +
|
||||
'</body>')
|
||||
|
||||
var radio0 = doc.getElementById("rad0");
|
||||
var radio1 = doc.getElementById("rad1");
|
||||
var radio2 = doc.getElementById("rad2");
|
||||
|
||||
test.ok(!radio0.checked, "radio not checked");
|
||||
test.ok(radio1.checked, "radio checked");
|
||||
test.ok(!radio2.checked, "radio not checked");
|
||||
|
||||
radio2.click()
|
||||
radio0.click();
|
||||
test.ok(radio0.checked, "radio checked");
|
||||
test.ok(!radio1.checked, "radio not checked");
|
||||
test.ok(radio2.checked, "radio checked");
|
||||
|
||||
radio1.click();
|
||||
test.ok(!radio0.checked, "radio not checked");
|
||||
test.ok(radio1.checked, "radio checked");
|
||||
test.ok(radio2.checked, "radio checked");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
radio_no_click_deselected : function(test) {
|
||||
doc = jsdom.jsdom(
|
||||
'<html><head></head><body>' +
|
||||
'<input type="radio" id="rad0" value="rad0" name="radioGroup0" />' +
|
||||
'</body>')
|
||||
|
||||
var radio0 = doc.getElementById("rad0");
|
||||
|
||||
radio0.click();
|
||||
test.ok(radio0.checked, "radio checked");
|
||||
|
||||
radio0.click();
|
||||
test.ok(radio0.checked, "radio checked");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_value_updates_value : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option value="x">x</option><option value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
|
||||
select.value = "x"
|
||||
test.equal(select.value, "x", "select element value");
|
||||
|
||||
select.value = "y"
|
||||
test.equal(select.value, "y", "select element selectedIndex");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_value_updates_selectedIndex : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option value="x">x</option><option value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
|
||||
select.value = "x"
|
||||
test.equal(select.selectedIndex, 0, "select element selectedIndex");
|
||||
|
||||
select.value = "y"
|
||||
test.equal(select.selectedIndex, 1, "select element selectedIndex");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_value_updates_option_selected : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
var option0 = doc.getElementById("optX");
|
||||
var option1 = doc.getElementById("optY");
|
||||
|
||||
select.value = "x";
|
||||
test.ok(option0.selected, "option element selected");
|
||||
|
||||
select.value = "y";
|
||||
test.ok(option1.selected, "option element selected");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_selectedIndex_updates_value : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option value="x">x</option><option value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
|
||||
select.selectedIndex = 0
|
||||
test.equal(select.value, "x", "select element selectedIndex");
|
||||
|
||||
select.selectedIndex = 1
|
||||
test.equal(select.value, "y", "select element selectedIndex");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_selectedIndex_updates_selectedIndex : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option value="x">x</option><option value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
|
||||
select.selectedIndex = 0
|
||||
test.equal(select.selectedIndex, 0, "select element selectedIndex");
|
||||
|
||||
select.selectedIndex = 1
|
||||
test.equal(select.selectedIndex, 1, "select element selectedIndex");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_selectedIndex_updates_option_selected : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
var option0 = doc.getElementById("optX");
|
||||
var option1 = doc.getElementById("optY");
|
||||
|
||||
select.selectedIndex = 0;
|
||||
test.ok(option0.selected, "option element selected");
|
||||
test.ok(!option1.selected, "option element selected");
|
||||
|
||||
select.selectedIndex = 1;
|
||||
test.ok(option1.selected, "option element selected");
|
||||
test.ok(!option0.selected, "option element selected");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_option_selected_updates_value : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
var option0 = doc.getElementById("optX");
|
||||
var option1 = doc.getElementById("optY");
|
||||
|
||||
select.selectedIndex = 0;
|
||||
option0.selected = true;
|
||||
test.equal(select.value, "x", "select element value");
|
||||
|
||||
option1.selected = true;
|
||||
test.equal(select.value, "y", "select element value");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_option_selected_updates_selectedIndex : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
var option0 = doc.getElementById("optX");
|
||||
var option1 = doc.getElementById("optY");
|
||||
|
||||
option0.selected = true;
|
||||
test.equal(select.selectedIndex, 0, "select element selectedIndex");
|
||||
|
||||
option1.selected = true;
|
||||
test.equal(select.selectedIndex, 1, "select element selectedIndex");
|
||||
|
||||
test.done();
|
||||
},
|
||||
|
||||
select_set_option_selected_updates_option_selected : function(test) {
|
||||
var doc = new browser.Document();
|
||||
|
||||
var html = doc.createElement("html");
|
||||
var body = doc.createElement("body");
|
||||
|
||||
doc.appendChild(html);
|
||||
html.appendChild(body);
|
||||
|
||||
body.innerHTML =
|
||||
'<select id="selectElement">' +
|
||||
'<option id="optX" value="x">x</option><option id="optY" value="y">y</option>' +
|
||||
'</select>';
|
||||
|
||||
var select = doc.getElementById("selectElement");
|
||||
var option0 = doc.getElementById("optX");
|
||||
var option1 = doc.getElementById("optY");
|
||||
|
||||
option0.selected = true;
|
||||
test.ok(option0.selected, "option element selected");
|
||||
test.ok(!option1.selected, "option element selected");
|
||||
|
||||
option1.selected = true;
|
||||
test.ok(option1.selected, "option element selected");
|
||||
test.ok(!option0.selected, "option element selected");
|
||||
|
||||
test.done();
|
||||
},
|
||||
};
|
36
bower_components/jsdom/test/collector.php
vendored
36
bower_components/jsdom/test/collector.php
vendored
@ -1,36 +0,0 @@
|
||||
<?php
|
||||
|
||||
|
||||
$files = glob($_SERVER['argv'][1] . "/*.html");
|
||||
|
||||
$segments = array_filter(explode('/', $_SERVER['argv'][1]));
|
||||
$last = array_pop($segments);
|
||||
$outputFile = implode('/', $segments) . "/{$last}.js";
|
||||
|
||||
$functions = array();
|
||||
$functionBodies = array();
|
||||
|
||||
foreach ($files as $file)
|
||||
{
|
||||
$content = file_get_contents($file);
|
||||
|
||||
$first = "// expose test function names";
|
||||
|
||||
$start = strpos($content, $first);
|
||||
$end = strpos($content, "</script>", $start + strlen($first));
|
||||
|
||||
|
||||
$substring = substr($content, $start+$first, $end-$start);
|
||||
|
||||
$function = substr($substring, strpos($substring, "/**"));
|
||||
|
||||
$function = str_replace("function ", "", $function);
|
||||
$function = str_replace("() {", " : function () {", $function);
|
||||
|
||||
// parse out the actual function
|
||||
array_push($functionBodies, trim($function));
|
||||
|
||||
}
|
||||
|
||||
|
||||
file_put_contents($outputFile, "exports.tests = {\n".implode(",\n", array_filter($functionBodies)) . '\n}');
|
10337
bower_components/jsdom/test/jquery-fixtures/jquery-1.11.0.js
vendored
10337
bower_components/jsdom/test/jquery-fixtures/jquery-1.11.0.js
vendored
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,167 +0,0 @@
|
||||
/*!
|
||||
* jQuery JavaScript Library v1.4.4
|
||||
* http://jquery.com/
|
||||
*
|
||||
* Copyright 2010, John Resig
|
||||
* Dual licensed under the MIT or GPL Version 2 licenses.
|
||||
* http://jquery.org/license
|
||||
*
|
||||
* Includes Sizzle.js
|
||||
* http://sizzlejs.com/
|
||||
* Copyright 2010, The Dojo Foundation
|
||||
* Released under the MIT, BSD, and GPL Licenses.
|
||||
*
|
||||
* Date: Thu Nov 11 19:04:53 2010 -0500
|
||||
*/
|
||||
(function(E,B){function ka(a,b,d){if(d===B&&a.nodeType===1){d=a.getAttribute("data-"+b);if(typeof d==="string"){try{d=d==="true"?true:d==="false"?false:d==="null"?null:!c.isNaN(d)?parseFloat(d):Ja.test(d)?c.parseJSON(d):d}catch(e){}c.data(a,b,d)}else d=B}return d}function U(){return false}function ca(){return true}function la(a,b,d){d[0].type=a;return c.event.handle.apply(b,d)}function Ka(a){var b,d,e,f,h,l,k,o,x,r,A,C=[];f=[];h=c.data(this,this.nodeType?"events":"__events__");if(typeof h==="function")h=
|
||||
h.events;if(!(a.liveFired===this||!h||!h.live||a.button&&a.type==="click")){if(a.namespace)A=RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)");a.liveFired=this;var J=h.live.slice(0);for(k=0;k<J.length;k++){h=J[k];h.origType.replace(X,"")===a.type?f.push(h.selector):J.splice(k--,1)}f=c(a.target).closest(f,a.currentTarget);o=0;for(x=f.length;o<x;o++){r=f[o];for(k=0;k<J.length;k++){h=J[k];if(r.selector===h.selector&&(!A||A.test(h.namespace))){l=r.elem;e=null;if(h.preType==="mouseenter"||
|
||||
h.preType==="mouseleave"){a.type=h.preType;e=c(a.relatedTarget).closest(h.selector)[0]}if(!e||e!==l)C.push({elem:l,handleObj:h,level:r.level})}}}o=0;for(x=C.length;o<x;o++){f=C[o];if(d&&f.level>d)break;a.currentTarget=f.elem;a.data=f.handleObj.data;a.handleObj=f.handleObj;A=f.handleObj.origHandler.apply(f.elem,arguments);if(A===false||a.isPropagationStopped()){d=f.level;if(A===false)b=false;if(a.isImmediatePropagationStopped())break}}return b}}function Y(a,b){return(a&&a!=="*"?a+".":"")+b.replace(La,
|
||||
"`").replace(Ma,"&")}function ma(a,b,d){if(c.isFunction(b))return c.grep(a,function(f,h){return!!b.call(f,h,f)===d});else if(b.nodeType)return c.grep(a,function(f){return f===b===d});else if(typeof b==="string"){var e=c.grep(a,function(f){return f.nodeType===1});if(Na.test(b))return c.filter(b,e,!d);else b=c.filter(b,e)}return c.grep(a,function(f){return c.inArray(f,b)>=0===d})}function na(a,b){var d=0;b.each(function(){if(this.nodeName===(a[d]&&a[d].nodeName)){var e=c.data(a[d++]),f=c.data(this,
|
||||
e);if(e=e&&e.events){delete f.handle;f.events={};for(var h in e)for(var l in e[h])c.event.add(this,h,e[h][l],e[h][l].data)}}})}function Oa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function oa(a,b,d){var e=b==="width"?a.offsetWidth:a.offsetHeight;if(d==="border")return e;c.each(b==="width"?Pa:Qa,function(){d||(e-=parseFloat(c.css(a,"padding"+this))||0);if(d==="margin")e+=parseFloat(c.css(a,
|
||||
"margin"+this))||0;else e-=parseFloat(c.css(a,"border"+this+"Width"))||0});return e}function da(a,b,d,e){if(c.isArray(b)&&b.length)c.each(b,function(f,h){d||Ra.test(a)?e(a,h):da(a+"["+(typeof h==="object"||c.isArray(h)?f:"")+"]",h,d,e)});else if(!d&&b!=null&&typeof b==="object")c.isEmptyObject(b)?e(a,""):c.each(b,function(f,h){da(a+"["+f+"]",h,d,e)});else e(a,b)}function S(a,b){var d={};c.each(pa.concat.apply([],pa.slice(0,b)),function(){d[this]=a});return d}function qa(a){if(!ea[a]){var b=c("<"+
|
||||
a+">").appendTo("body"),d=b.css("display");b.remove();if(d==="none"||d==="")d="block";ea[a]=d}return ea[a]}function fa(a){return c.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:false}var t=E.document,c=function(){function a(){if(!b.isReady){try{t.documentElement.doScroll("left")}catch(j){setTimeout(a,1);return}b.ready()}}var b=function(j,s){return new b.fn.init(j,s)},d=E.jQuery,e=E.$,f,h=/^(?:[^<]*(<[\w\W]+>)[^>]*$|#([\w\-]+)$)/,l=/\S/,k=/^\s+/,o=/\s+$/,x=/\W/,r=/\d/,A=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,
|
||||
C=/^[\],:{}\s]*$/,J=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,w=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,I=/(?:^|:|,)(?:\s*\[)+/g,L=/(webkit)[ \/]([\w.]+)/,g=/(opera)(?:.*version)?[ \/]([\w.]+)/,i=/(msie) ([\w.]+)/,n=/(mozilla)(?:.*? rv:([\w.]+))?/,m=navigator.userAgent,p=false,q=[],u,y=Object.prototype.toString,F=Object.prototype.hasOwnProperty,M=Array.prototype.push,N=Array.prototype.slice,O=String.prototype.trim,D=Array.prototype.indexOf,R={};b.fn=b.prototype={init:function(j,
|
||||
s){var v,z,H;if(!j)return this;if(j.nodeType){this.context=this[0]=j;this.length=1;return this}if(j==="body"&&!s&&t.body){this.context=t;this[0]=t.body;this.selector="body";this.length=1;return this}if(typeof j==="string")if((v=h.exec(j))&&(v[1]||!s))if(v[1]){H=s?s.ownerDocument||s:t;if(z=A.exec(j))if(b.isPlainObject(s)){j=[t.createElement(z[1])];b.fn.attr.call(j,s,true)}else j=[H.createElement(z[1])];else{z=b.buildFragment([v[1]],[H]);j=(z.cacheable?z.fragment.cloneNode(true):z.fragment).childNodes}return b.merge(this,
|
||||
j)}else{if((z=t.getElementById(v[2]))&&z.parentNode){if(z.id!==v[2])return f.find(j);this.length=1;this[0]=z}this.context=t;this.selector=j;return this}else if(!s&&!x.test(j)){this.selector=j;this.context=t;j=t.getElementsByTagName(j);return b.merge(this,j)}else return!s||s.jquery?(s||f).find(j):b(s).find(j);else if(b.isFunction(j))return f.ready(j);if(j.selector!==B){this.selector=j.selector;this.context=j.context}return b.makeArray(j,this)},selector:"",jquery:"1.4.4",length:0,size:function(){return this.length},
|
||||
toArray:function(){return N.call(this,0)},get:function(j){return j==null?this.toArray():j<0?this.slice(j)[0]:this[j]},pushStack:function(j,s,v){var z=b();b.isArray(j)?M.apply(z,j):b.merge(z,j);z.prevObject=this;z.context=this.context;if(s==="find")z.selector=this.selector+(this.selector?" ":"")+v;else if(s)z.selector=this.selector+"."+s+"("+v+")";return z},each:function(j,s){return b.each(this,j,s)},ready:function(j){b.bindReady();if(b.isReady)j.call(t,b);else q&&q.push(j);return this},eq:function(j){return j===
|
||||
-1?this.slice(j):this.slice(j,+j+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(N.apply(this,arguments),"slice",N.call(arguments).join(","))},map:function(j){return this.pushStack(b.map(this,function(s,v){return j.call(s,v,s)}))},end:function(){return this.prevObject||b(null)},push:M,sort:[].sort,splice:[].splice};b.fn.init.prototype=b.fn;b.extend=b.fn.extend=function(){var j,s,v,z,H,G=arguments[0]||{},K=1,Q=arguments.length,ga=false;
|
||||
if(typeof G==="boolean"){ga=G;G=arguments[1]||{};K=2}if(typeof G!=="object"&&!b.isFunction(G))G={};if(Q===K){G=this;--K}for(;K<Q;K++)if((j=arguments[K])!=null)for(s in j){v=G[s];z=j[s];if(G!==z)if(ga&&z&&(b.isPlainObject(z)||(H=b.isArray(z)))){if(H){H=false;v=v&&b.isArray(v)?v:[]}else v=v&&b.isPlainObject(v)?v:{};G[s]=b.extend(ga,v,z)}else if(z!==B)G[s]=z}return G};b.extend({noConflict:function(j){E.$=e;if(j)E.jQuery=d;return b},isReady:false,readyWait:1,ready:function(j){j===true&&b.readyWait--;
|
||||
if(!b.readyWait||j!==true&&!b.isReady){if(!t.body)return setTimeout(b.ready,1);b.isReady=true;if(!(j!==true&&--b.readyWait>0))if(q){var s=0,v=q;for(q=null;j=v[s++];)j.call(t,b);b.fn.trigger&&b(t).trigger("ready").unbind("ready")}}},bindReady:function(){if(!p){p=true;if(t.readyState==="complete")return setTimeout(b.ready,1);if(t.addEventListener){t.addEventListener("DOMContentLoaded",u,false);E.addEventListener("load",b.ready,false)}else if(t.attachEvent){t.attachEvent("onreadystatechange",u);E.attachEvent("onload",
|
||||
b.ready);var j=false;try{j=E.frameElement==null}catch(s){}t.documentElement.doScroll&&j&&a()}}},isFunction:function(j){return b.type(j)==="function"},isArray:Array.isArray||function(j){return b.type(j)==="array"},isWindow:function(j){return j&&typeof j==="object"&&"setInterval"in j},isNaN:function(j){return j==null||!r.test(j)||isNaN(j)},type:function(j){return j==null?String(j):R[y.call(j)]||"object"},isPlainObject:function(j){if(!j||b.type(j)!=="object"||j.nodeType||b.isWindow(j))return false;if(j.constructor&&
|
||||
!F.call(j,"constructor")&&!F.call(j.constructor.prototype,"isPrototypeOf"))return false;for(var s in j);return s===B||F.call(j,s)},isEmptyObject:function(j){for(var s in j)return false;return true},error:function(j){throw j;},parseJSON:function(j){if(typeof j!=="string"||!j)return null;j=b.trim(j);if(C.test(j.replace(J,"@").replace(w,"]").replace(I,"")))return E.JSON&&E.JSON.parse?E.JSON.parse(j):(new Function("return "+j))();else b.error("Invalid JSON: "+j)},noop:function(){},globalEval:function(j){if(j&&
|
||||
l.test(j)){var s=t.getElementsByTagName("head")[0]||t.documentElement,v=t.createElement("script");v.type="text/javascript";if(b.support.scriptEval)v.appendChild(t.createTextNode(j));else v.text=j;s.insertBefore(v,s.firstChild);s.removeChild(v)}},nodeName:function(j,s){return j.nodeName&&j.nodeName.toUpperCase()===s.toUpperCase()},each:function(j,s,v){var z,H=0,G=j.length,K=G===B||b.isFunction(j);if(v)if(K)for(z in j){if(s.apply(j[z],v)===false)break}else for(;H<G;){if(s.apply(j[H++],v)===false)break}else if(K)for(z in j){if(s.call(j[z],
|
||||
z,j[z])===false)break}else for(v=j[0];H<G&&s.call(v,H,v)!==false;v=j[++H]);return j},trim:O?function(j){return j==null?"":O.call(j)}:function(j){return j==null?"":j.toString().replace(k,"").replace(o,"")},makeArray:function(j,s){var v=s||[];if(j!=null){var z=b.type(j);j.length==null||z==="string"||z==="function"||z==="regexp"||b.isWindow(j)?M.call(v,j):b.merge(v,j)}return v},inArray:function(j,s){if(s.indexOf)return s.indexOf(j);for(var v=0,z=s.length;v<z;v++)if(s[v]===j)return v;return-1},merge:function(j,
|
||||
s){var v=j.length,z=0;if(typeof s.length==="number")for(var H=s.length;z<H;z++)j[v++]=s[z];else for(;s[z]!==B;)j[v++]=s[z++];j.length=v;return j},grep:function(j,s,v){var z=[],H;v=!!v;for(var G=0,K=j.length;G<K;G++){H=!!s(j[G],G);v!==H&&z.push(j[G])}return z},map:function(j,s,v){for(var z=[],H,G=0,K=j.length;G<K;G++){H=s(j[G],G,v);if(H!=null)z[z.length]=H}return z.concat.apply([],z)},guid:1,proxy:function(j,s,v){if(arguments.length===2)if(typeof s==="string"){v=j;j=v[s];s=B}else if(s&&!b.isFunction(s)){v=
|
||||
s;s=B}if(!s&&j)s=function(){return j.apply(v||this,arguments)};if(j)s.guid=j.guid=j.guid||s.guid||b.guid++;return s},access:function(j,s,v,z,H,G){var K=j.length;if(typeof s==="object"){for(var Q in s)b.access(j,Q,s[Q],z,H,v);return j}if(v!==B){z=!G&&z&&b.isFunction(v);for(Q=0;Q<K;Q++)H(j[Q],s,z?v.call(j[Q],Q,H(j[Q],s)):v,G);return j}return K?H(j[0],s):B},now:function(){return(new Date).getTime()},uaMatch:function(j){j=j.toLowerCase();j=L.exec(j)||g.exec(j)||i.exec(j)||j.indexOf("compatible")<0&&n.exec(j)||
|
||||
[];return{browser:j[1]||"",version:j[2]||"0"}},browser:{}});b.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(j,s){R["[object "+s+"]"]=s.toLowerCase()});m=b.uaMatch(m);if(m.browser){b.browser[m.browser]=true;b.browser.version=m.version}if(b.browser.webkit)b.browser.safari=true;if(D)b.inArray=function(j,s){return D.call(s,j)};if(!/\s/.test("\u00a0")){k=/^[\s\xA0]+/;o=/[\s\xA0]+$/}f=b(t);if(t.addEventListener)u=function(){t.removeEventListener("DOMContentLoaded",u,
|
||||
false);b.ready()};else if(t.attachEvent)u=function(){if(t.readyState==="complete"){t.detachEvent("onreadystatechange",u);b.ready()}};return E.jQuery=E.$=b}();(function(){c.support={};var a=t.documentElement,b=t.createElement("script"),d=t.createElement("div"),e="script"+c.now();d.style.display="none";d.innerHTML=" <link/><table></table><a href='/a' style='color:red;float:left;opacity:.55;'>a</a><input type='checkbox'/>";var f=d.getElementsByTagName("*"),h=d.getElementsByTagName("a")[0],l=t.createElement("select"),
|
||||
k=l.appendChild(t.createElement("option"));if(!(!f||!f.length||!h)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(h.getAttribute("style")),hrefNormalized:h.getAttribute("href")==="/a",opacity:/^0.55$/.test(h.style.opacity),cssFloat:!!h.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:k.selected,deleteExpando:true,optDisabled:false,checkClone:false,
|
||||
scriptEval:false,noCloneEvent:true,boxModel:null,inlineBlockNeedsLayout:false,shrinkWrapBlocks:false,reliableHiddenOffsets:true};l.disabled=true;c.support.optDisabled=!k.disabled;b.type="text/javascript";try{b.appendChild(t.createTextNode("window."+e+"=1;"))}catch(o){}a.insertBefore(b,a.firstChild);if(E[e]){c.support.scriptEval=true;delete E[e]}try{delete b.test}catch(x){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function r(){c.support.noCloneEvent=
|
||||
false;d.detachEvent("onclick",r)});d.cloneNode(true).fireEvent("onclick")}d=t.createElement("div");d.innerHTML="<input type='radio' name='radiotest' checked='checked'/>";a=t.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var r=t.createElement("div");r.style.width=r.style.paddingLeft="1px";t.body.appendChild(r);c.boxModel=c.support.boxModel=r.offsetWidth===2;if("zoom"in r.style){r.style.display="inline";r.style.zoom=
|
||||
1;c.support.inlineBlockNeedsLayout=r.offsetWidth===2;r.style.display="";r.innerHTML="<div style='width:4px;'></div>";c.support.shrinkWrapBlocks=r.offsetWidth!==2}r.innerHTML="<table><tr><td style='padding:0;display:none'></td><td>t</td></tr></table>";var A=r.getElementsByTagName("td");c.support.reliableHiddenOffsets=A[0].offsetHeight===0;A[0].style.display="";A[1].style.display="none";c.support.reliableHiddenOffsets=c.support.reliableHiddenOffsets&&A[0].offsetHeight===0;r.innerHTML="";t.body.removeChild(r).style.display=
|
||||
"none"});a=function(r){var A=t.createElement("div");r="on"+r;var C=r in A;if(!C){A.setAttribute(r,"return;");C=typeof A[r]==="function"}return C};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=f=h=null}})();var ra={},Ja=/^(?:\{.*\}|\[.*\])$/;c.extend({cache:{},uuid:0,expando:"jQuery"+c.now(),noData:{embed:true,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:true},data:function(a,b,d){if(c.acceptData(a)){a=a==E?ra:a;var e=a.nodeType,f=e?a[c.expando]:null,h=
|
||||
c.cache;if(!(e&&!f&&typeof b==="string"&&d===B)){if(e)f||(a[c.expando]=f=++c.uuid);else h=a;if(typeof b==="object")if(e)h[f]=c.extend(h[f],b);else c.extend(h,b);else if(e&&!h[f])h[f]={};a=e?h[f]:h;if(d!==B)a[b]=d;return typeof b==="string"?a[b]:a}}},removeData:function(a,b){if(c.acceptData(a)){a=a==E?ra:a;var d=a.nodeType,e=d?a[c.expando]:a,f=c.cache,h=d?f[e]:e;if(b){if(h){delete h[b];d&&c.isEmptyObject(h)&&c.removeData(a)}}else if(d&&c.support.deleteExpando)delete a[c.expando];else if(a.removeAttribute)a.removeAttribute(c.expando);
|
||||
else if(d)delete f[e];else for(var l in a)delete a[l]}},acceptData:function(a){if(a.nodeName){var b=c.noData[a.nodeName.toLowerCase()];if(b)return!(b===true||a.getAttribute("classid")!==b)}return true}});c.fn.extend({data:function(a,b){var d=null;if(typeof a==="undefined"){if(this.length){var e=this[0].attributes,f;d=c.data(this[0]);for(var h=0,l=e.length;h<l;h++){f=e[h].name;if(f.indexOf("data-")===0){f=f.substr(5);ka(this[0],f,d[f])}}}return d}else if(typeof a==="object")return this.each(function(){c.data(this,
|
||||
a)});var k=a.split(".");k[1]=k[1]?"."+k[1]:"";if(b===B){d=this.triggerHandler("getData"+k[1]+"!",[k[0]]);if(d===B&&this.length){d=c.data(this[0],a);d=ka(this[0],a,d)}return d===B&&k[1]?this.data(k[0]):d}else return this.each(function(){var o=c(this),x=[k[0],b];o.triggerHandler("setData"+k[1]+"!",x);c.data(this,a,b);o.triggerHandler("changeData"+k[1]+"!",x)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var e=
|
||||
c.data(a,b);if(!d)return e||[];if(!e||c.isArray(d))e=c.data(a,b,c.makeArray(d));else e.push(d);return e}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),e=d.shift();if(e==="inprogress")e=d.shift();if(e){b==="fx"&&d.unshift("inprogress");e.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b===B)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,
|
||||
a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var sa=/[\n\t]/g,ha=/\s+/,Sa=/\r/g,Ta=/^(?:href|src|style)$/,Ua=/^(?:button|input)$/i,Va=/^(?:button|input|object|select|textarea)$/i,Wa=/^a(?:rea)?$/i,ta=/^(?:radio|checkbox)$/i;c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",
|
||||
colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};c.fn.extend({attr:function(a,b){return c.access(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(x){var r=c(this);r.addClass(a.call(this,x,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===
|
||||
1)if(f.className){for(var h=" "+f.className+" ",l=f.className,k=0,o=b.length;k<o;k++)if(h.indexOf(" "+b[k]+" ")<0)l+=" "+b[k];f.className=c.trim(l)}else f.className=a}return this},removeClass:function(a){if(c.isFunction(a))return this.each(function(o){var x=c(this);x.removeClass(a.call(this,o,x.attr("class")))});if(a&&typeof a==="string"||a===B)for(var b=(a||"").split(ha),d=0,e=this.length;d<e;d++){var f=this[d];if(f.nodeType===1&&f.className)if(a){for(var h=(" "+f.className+" ").replace(sa," "),
|
||||
l=0,k=b.length;l<k;l++)h=h.replace(" "+b[l]+" "," ");f.className=c.trim(h)}else f.className=""}return this},toggleClass:function(a,b){var d=typeof a,e=typeof b==="boolean";if(c.isFunction(a))return this.each(function(f){var h=c(this);h.toggleClass(a.call(this,f,h.attr("class"),b),b)});return this.each(function(){if(d==="string")for(var f,h=0,l=c(this),k=b,o=a.split(ha);f=o[h++];){k=e?k:!l.hasClass(f);l[k?"addClass":"removeClass"](f)}else if(d==="undefined"||d==="boolean"){this.className&&c.data(this,
|
||||
"__className__",this.className);this.className=this.className||a===false?"":c.data(this,"__className__")||""}})},hasClass:function(a){a=" "+a+" ";for(var b=0,d=this.length;b<d;b++)if((" "+this[b].className+" ").replace(sa," ").indexOf(a)>-1)return true;return false},val:function(a){if(!arguments.length){var b=this[0];if(b){if(c.nodeName(b,"option")){var d=b.attributes.value;return!d||d.specified?b.value:b.text}if(c.nodeName(b,"select")){var e=b.selectedIndex;d=[];var f=b.options;b=b.type==="select-one";
|
||||
if(e<0)return null;var h=b?e:0;for(e=b?e+1:f.length;h<e;h++){var l=f[h];if(l.selected&&(c.support.optDisabled?!l.disabled:l.getAttribute("disabled")===null)&&(!l.parentNode.disabled||!c.nodeName(l.parentNode,"optgroup"))){a=c(l).val();if(b)return a;d.push(a)}}return d}if(ta.test(b.type)&&!c.support.checkOn)return b.getAttribute("value")===null?"on":b.value;return(b.value||"").replace(Sa,"")}return B}var k=c.isFunction(a);return this.each(function(o){var x=c(this),r=a;if(this.nodeType===1){if(k)r=
|
||||
a.call(this,o,x.val());if(r==null)r="";else if(typeof r==="number")r+="";else if(c.isArray(r))r=c.map(r,function(C){return C==null?"":C+""});if(c.isArray(r)&&ta.test(this.type))this.checked=c.inArray(x.val(),r)>=0;else if(c.nodeName(this,"select")){var A=c.makeArray(r);c("option",this).each(function(){this.selected=c.inArray(c(this).val(),A)>=0});if(!A.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},
|
||||
attr:function(a,b,d,e){if(!a||a.nodeType===3||a.nodeType===8)return B;if(e&&b in c.attrFn)return c(a)[b](d);e=a.nodeType!==1||!c.isXMLDoc(a);var f=d!==B;b=e&&c.props[b]||b;var h=Ta.test(b);if((b in a||a[b]!==B)&&e&&!h){if(f){b==="type"&&Ua.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed");if(d===null)a.nodeType===1&&a.removeAttribute(b);else a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&
|
||||
b.specified?b.value:Va.test(a.nodeName)||Wa.test(a.nodeName)&&a.href?0:B;return a[b]}if(!c.support.style&&e&&b==="style"){if(f)a.style.cssText=""+d;return a.style.cssText}f&&a.setAttribute(b,""+d);if(!a.attributes[b]&&a.hasAttribute&&!a.hasAttribute(b))return B;a=!c.support.hrefNormalized&&e&&h?a.getAttribute(b,2):a.getAttribute(b);return a===null?B:a}});var X=/\.(.*)$/,ia=/^(?:textarea|input|select)$/i,La=/\./g,Ma=/ /g,Xa=/[^\w\s.|`]/g,Ya=function(a){return a.replace(Xa,"\\$&")},ua={focusin:0,focusout:0};
|
||||
c.event={add:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(c.isWindow(a)&&a!==E&&!a.frameElement)a=E;if(d===false)d=U;else if(!d)return;var f,h;if(d.handler){f=d;d=f.handler}if(!d.guid)d.guid=c.guid++;if(h=c.data(a)){var l=a.nodeType?"events":"__events__",k=h[l],o=h.handle;if(typeof k==="function"){o=k.handle;k=k.events}else if(!k){a.nodeType||(h[l]=h=function(){});h.events=k={}}if(!o)h.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,
|
||||
arguments):B};o.elem=a;b=b.split(" ");for(var x=0,r;l=b[x++];){h=f?c.extend({},f):{handler:d,data:e};if(l.indexOf(".")>-1){r=l.split(".");l=r.shift();h.namespace=r.slice(0).sort().join(".")}else{r=[];h.namespace=""}h.type=l;if(!h.guid)h.guid=d.guid;var A=k[l],C=c.event.special[l]||{};if(!A){A=k[l]=[];if(!C.setup||C.setup.call(a,e,r,o)===false)if(a.addEventListener)a.addEventListener(l,o,false);else a.attachEvent&&a.attachEvent("on"+l,o)}if(C.add){C.add.call(a,h);if(!h.handler.guid)h.handler.guid=
|
||||
d.guid}A.push(h);c.event.global[l]=true}a=null}}},global:{},remove:function(a,b,d,e){if(!(a.nodeType===3||a.nodeType===8)){if(d===false)d=U;var f,h,l=0,k,o,x,r,A,C,J=a.nodeType?"events":"__events__",w=c.data(a),I=w&&w[J];if(w&&I){if(typeof I==="function"){w=I;I=I.events}if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(f in I)c.event.remove(a,f+b)}else{for(b=b.split(" ");f=b[l++];){r=f;k=f.indexOf(".")<0;o=[];if(!k){o=f.split(".");f=o.shift();x=RegExp("(^|\\.)"+
|
||||
c.map(o.slice(0).sort(),Ya).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(A=I[f])if(d){r=c.event.special[f]||{};for(h=e||0;h<A.length;h++){C=A[h];if(d.guid===C.guid){if(k||x.test(C.namespace)){e==null&&A.splice(h--,1);r.remove&&r.remove.call(a,C)}if(e!=null)break}}if(A.length===0||e!=null&&A.length===1){if(!r.teardown||r.teardown.call(a,o)===false)c.removeEvent(a,f,w.handle);delete I[f]}}else for(h=0;h<A.length;h++){C=A[h];if(k||x.test(C.namespace)){c.event.remove(a,r,C.handler,h);A.splice(h--,1)}}}if(c.isEmptyObject(I)){if(b=
|
||||
w.handle)b.elem=null;delete w.events;delete w.handle;if(typeof w==="function")c.removeData(a,J);else c.isEmptyObject(w)&&c.removeData(a)}}}}},trigger:function(a,b,d,e){var f=a.type||a;if(!e){a=typeof a==="object"?a[c.expando]?a:c.extend(c.Event(f),a):c.Event(f);if(f.indexOf("!")>=0){a.type=f=f.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[f]&&c.each(c.cache,function(){this.events&&this.events[f]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===
|
||||
8)return B;a.result=B;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(e=d.nodeType?c.data(d,"handle"):(c.data(d,"__events__")||{}).handle)&&e.apply(d,b);e=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+f]&&d["on"+f].apply(d,b)===false){a.result=false;a.preventDefault()}}catch(h){}if(!a.isPropagationStopped()&&e)c.event.trigger(a,b,e,true);else if(!a.isDefaultPrevented()){var l;e=a.target;var k=f.replace(X,""),o=c.nodeName(e,"a")&&k===
|
||||
"click",x=c.event.special[k]||{};if((!x._default||x._default.call(d,a)===false)&&!o&&!(e&&e.nodeName&&c.noData[e.nodeName.toLowerCase()])){try{if(e[k]){if(l=e["on"+k])e["on"+k]=null;c.event.triggered=true;e[k]()}}catch(r){}if(l)e["on"+k]=l;c.event.triggered=false}}},handle:function(a){var b,d,e,f;d=[];var h=c.makeArray(arguments);a=h[0]=c.event.fix(a||E.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive;if(!b){e=a.type.split(".");a.type=e.shift();d=e.slice(0).sort();e=RegExp("(^|\\.)"+
|
||||
d.join("\\.(?:.*\\.)?")+"(\\.|$)")}a.namespace=a.namespace||d.join(".");f=c.data(this,this.nodeType?"events":"__events__");if(typeof f==="function")f=f.events;d=(f||{})[a.type];if(f&&d){d=d.slice(0);f=0;for(var l=d.length;f<l;f++){var k=d[f];if(b||e.test(k.namespace)){a.handler=k.handler;a.data=k.data;a.handleObj=k;k=k.handler.apply(this,h);if(k!==B){a.result=k;if(k===false){a.preventDefault();a.stopPropagation()}}if(a.isImmediatePropagationStopped())break}}}return a.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),
|
||||
fix:function(a){if(a[c.expando])return a;var b=a;a=c.Event(b);for(var d=this.props.length,e;d;){e=this.props[--d];a[e]=b[e]}if(!a.target)a.target=a.srcElement||t;if(a.target.nodeType===3)a.target=a.target.parentNode;if(!a.relatedTarget&&a.fromElement)a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement;if(a.pageX==null&&a.clientX!=null){b=t.documentElement;d=t.body;a.pageX=a.clientX+(b&&b.scrollLeft||d&&d.scrollLeft||0)-(b&&b.clientLeft||d&&d.clientLeft||0);a.pageY=a.clientY+(b&&b.scrollTop||
|
||||
d&&d.scrollTop||0)-(b&&b.clientTop||d&&d.clientTop||0)}if(a.which==null&&(a.charCode!=null||a.keyCode!=null))a.which=a.charCode!=null?a.charCode:a.keyCode;if(!a.metaKey&&a.ctrlKey)a.metaKey=a.ctrlKey;if(!a.which&&a.button!==B)a.which=a.button&1?1:a.button&2?3:a.button&4?2:0;return a},guid:1E8,proxy:c.proxy,special:{ready:{setup:c.bindReady,teardown:c.noop},live:{add:function(a){c.event.add(this,Y(a.origType,a.selector),c.extend({},a,{handler:Ka,guid:a.handler.guid}))},remove:function(a){c.event.remove(this,
|
||||
Y(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,d){if(c.isWindow(this))this.onbeforeunload=d},teardown:function(a,b){if(this.onbeforeunload===b)this.onbeforeunload=null}}}};c.removeEvent=t.removeEventListener?function(a,b,d){a.removeEventListener&&a.removeEventListener(b,d,false)}:function(a,b,d){a.detachEvent&&a.detachEvent("on"+b,d)};c.Event=function(a){if(!this.preventDefault)return new c.Event(a);if(a&&a.type){this.originalEvent=a;this.type=a.type}else this.type=a;this.timeStamp=
|
||||
c.now();this[c.expando]=true};c.Event.prototype={preventDefault:function(){this.isDefaultPrevented=ca;var a=this.originalEvent;if(a)if(a.preventDefault)a.preventDefault();else a.returnValue=false},stopPropagation:function(){this.isPropagationStopped=ca;var a=this.originalEvent;if(a){a.stopPropagation&&a.stopPropagation();a.cancelBubble=true}},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=ca;this.stopPropagation()},isDefaultPrevented:U,isPropagationStopped:U,isImmediatePropagationStopped:U};
|
||||
var va=function(a){var b=a.relatedTarget;try{for(;b&&b!==this;)b=b.parentNode;if(b!==this){a.type=a.data;c.event.handle.apply(this,arguments)}}catch(d){}},wa=function(a){a.type=a.data;c.event.handle.apply(this,arguments)};c.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){c.event.special[a]={setup:function(d){c.event.add(this,b,d&&d.selector?wa:va,a)},teardown:function(d){c.event.remove(this,b,d&&d.selector?wa:va)}}});if(!c.support.submitBubbles)c.event.special.submit={setup:function(){if(this.nodeName.toLowerCase()!==
|
||||
"form"){c.event.add(this,"click.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="submit"||d==="image")&&c(b).closest("form").length){a.liveFired=B;return la("submit",this,arguments)}});c.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,d=b.type;if((d==="text"||d==="password")&&c(b).closest("form").length&&a.keyCode===13){a.liveFired=B;return la("submit",this,arguments)}})}else return false},teardown:function(){c.event.remove(this,".specialSubmit")}};if(!c.support.changeBubbles){var V,
|
||||
xa=function(a){var b=a.type,d=a.value;if(b==="radio"||b==="checkbox")d=a.checked;else if(b==="select-multiple")d=a.selectedIndex>-1?c.map(a.options,function(e){return e.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},Z=function(a,b){var d=a.target,e,f;if(!(!ia.test(d.nodeName)||d.readOnly)){e=c.data(d,"_change_data");f=xa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data",f);if(!(e===B||f===e))if(e!=null||f){a.type="change";a.liveFired=
|
||||
B;return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:Z,beforedeactivate:Z,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return Z.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return Z.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a,"_change_data",xa(a))}},setup:function(){if(this.type===
|
||||
"file")return false;for(var a in V)c.event.add(this,a+".specialChange",V[a]);return ia.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return ia.test(this.nodeName)}};V=c.event.special.change.filters;V.focus=V.beforeactivate}t.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(e){e=c.event.fix(e);e.type=b;return c.event.trigger(e,null,e.target)}c.event.special[b]={setup:function(){ua[b]++===0&&t.addEventListener(a,d,true)},teardown:function(){--ua[b]===
|
||||
0&&t.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,e,f){if(typeof d==="object"){for(var h in d)this[b](h,e,d[h],f);return this}if(c.isFunction(e)||e===false){f=e;e=B}var l=b==="one"?c.proxy(f,function(o){c(this).unbind(o,l);return f.apply(this,arguments)}):f;if(d==="unload"&&b!=="one")this.one(d,e,f);else{h=0;for(var k=this.length;h<k;h++)c.event.add(this[h],d,l,e)}return this}});c.fn.extend({unbind:function(a,b){if(typeof a==="object"&&!a.preventDefault)for(var d in a)this.unbind(d,
|
||||
a[d]);else{d=0;for(var e=this.length;d<e;d++)c.event.remove(this[d],a,b)}return this},delegate:function(a,b,d,e){return this.live(b,d,e,a)},undelegate:function(a,b,d){return arguments.length===0?this.unbind("live"):this.die(b,null,d,a)},trigger:function(a,b){return this.each(function(){c.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0]){var d=c.Event(a);d.preventDefault();d.stopPropagation();c.event.trigger(d,b,this[0]);return d.result}},toggle:function(a){for(var b=arguments,d=
|
||||
1;d<b.length;)c.proxy(a,b[d++]);return this.click(c.proxy(a,function(e){var f=(c.data(this,"lastToggle"+a.guid)||0)%d;c.data(this,"lastToggle"+a.guid,f+1);e.preventDefault();return b[f].apply(this,arguments)||false}))},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var ya={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};c.each(["live","die"],function(a,b){c.fn[b]=function(d,e,f,h){var l,k=0,o,x,r=h||this.selector;h=h?this:c(this.context);if(typeof d===
|
||||
"object"&&!d.preventDefault){for(l in d)h[b](l,e,d[l],r);return this}if(c.isFunction(e)){f=e;e=B}for(d=(d||"").split(" ");(l=d[k++])!=null;){o=X.exec(l);x="";if(o){x=o[0];l=l.replace(X,"")}if(l==="hover")d.push("mouseenter"+x,"mouseleave"+x);else{o=l;if(l==="focus"||l==="blur"){d.push(ya[l]+x);l+=x}else l=(ya[l]||l)+x;if(b==="live"){x=0;for(var A=h.length;x<A;x++)c.event.add(h[x],"live."+Y(l,r),{data:e,selector:r,handler:f,origType:l,origHandler:f,preType:o})}else h.unbind("live."+Y(l,r),f)}}return this}});
|
||||
c.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){c.fn[b]=function(d,e){if(e==null){e=d;d=null}return arguments.length>0?this.bind(b,d,e):this.trigger(b)};if(c.attrFn)c.attrFn[b]=true});E.attachEvent&&!E.addEventListener&&c(E).bind("unload",function(){for(var a in c.cache)if(c.cache[a].handle)try{c.event.remove(c.cache[a].handle.elem)}catch(b){}});
|
||||
(function(){function a(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1&&!q){y.sizcache=n;y.sizset=p}if(y.nodeName.toLowerCase()===i){F=y;break}y=y[g]}m[p]=F}}}function b(g,i,n,m,p,q){p=0;for(var u=m.length;p<u;p++){var y=m[p];if(y){var F=false;for(y=y[g];y;){if(y.sizcache===n){F=m[y.sizset];break}if(y.nodeType===1){if(!q){y.sizcache=n;y.sizset=p}if(typeof i!=="string"){if(y===i){F=true;break}}else if(k.filter(i,
|
||||
[y]).length>0){F=y;break}}y=y[g]}m[p]=F}}}var d=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,e=0,f=Object.prototype.toString,h=false,l=true;[0,0].sort(function(){l=false;return 0});var k=function(g,i,n,m){n=n||[];var p=i=i||t;if(i.nodeType!==1&&i.nodeType!==9)return[];if(!g||typeof g!=="string")return n;var q,u,y,F,M,N=true,O=k.isXML(i),D=[],R=g;do{d.exec("");if(q=d.exec(R)){R=q[3];D.push(q[1]);if(q[2]){F=q[3];
|
||||
break}}}while(q);if(D.length>1&&x.exec(g))if(D.length===2&&o.relative[D[0]])u=L(D[0]+D[1],i);else for(u=o.relative[D[0]]?[i]:k(D.shift(),i);D.length;){g=D.shift();if(o.relative[g])g+=D.shift();u=L(g,u)}else{if(!m&&D.length>1&&i.nodeType===9&&!O&&o.match.ID.test(D[0])&&!o.match.ID.test(D[D.length-1])){q=k.find(D.shift(),i,O);i=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]}if(i){q=m?{expr:D.pop(),set:C(m)}:k.find(D.pop(),D.length===1&&(D[0]==="~"||D[0]==="+")&&i.parentNode?i.parentNode:i,O);u=q.expr?k.filter(q.expr,
|
||||
q.set):q.set;if(D.length>0)y=C(u);else N=false;for(;D.length;){q=M=D.pop();if(o.relative[M])q=D.pop();else M="";if(q==null)q=i;o.relative[M](y,q,O)}}else y=[]}y||(y=u);y||k.error(M||g);if(f.call(y)==="[object Array]")if(N)if(i&&i.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&k.contains(i,y[g])))n.push(u[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&n.push(u[g]);else n.push.apply(n,y);else C(y,n);if(F){k(F,p,n,m);k.uniqueSort(n)}return n};k.uniqueSort=function(g){if(w){h=
|
||||
l;g.sort(w);if(h)for(var i=1;i<g.length;i++)g[i]===g[i-1]&&g.splice(i--,1)}return g};k.matches=function(g,i){return k(g,null,null,i)};k.matchesSelector=function(g,i){return k(i,null,null,[g]).length>0};k.find=function(g,i,n){var m;if(!g)return[];for(var p=0,q=o.order.length;p<q;p++){var u,y=o.order[p];if(u=o.leftMatch[y].exec(g)){var F=u[1];u.splice(1,1);if(F.substr(F.length-1)!=="\\"){u[1]=(u[1]||"").replace(/\\/g,"");m=o.find[y](u,i,n);if(m!=null){g=g.replace(o.match[y],"");break}}}}m||(m=i.getElementsByTagName("*"));
|
||||
return{set:m,expr:g}};k.filter=function(g,i,n,m){for(var p,q,u=g,y=[],F=i,M=i&&i[0]&&k.isXML(i[0]);g&&i.length;){for(var N in o.filter)if((p=o.leftMatch[N].exec(g))!=null&&p[2]){var O,D,R=o.filter[N];D=p[1];q=false;p.splice(1,1);if(D.substr(D.length-1)!=="\\"){if(F===y)y=[];if(o.preFilter[N])if(p=o.preFilter[N](p,F,n,y,m,M)){if(p===true)continue}else q=O=true;if(p)for(var j=0;(D=F[j])!=null;j++)if(D){O=R(D,p,j,F);var s=m^!!O;if(n&&O!=null)if(s)q=true;else F[j]=false;else if(s){y.push(D);q=true}}if(O!==
|
||||
B){n||(F=y);g=g.replace(o.match[N],"");if(!q)return[];break}}}if(g===u)if(q==null)k.error(g);else break;u=g}return F};k.error=function(g){throw"Syntax error, unrecognized expression: "+g;};var o=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(['"]*)(.*?)\3|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\((even|odd|[\dn+\-]*)\))?/,
|
||||
POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(g){return g.getAttribute("href")}},relative:{"+":function(g,i){var n=typeof i==="string",m=n&&!/\W/.test(i);n=n&&!m;if(m)i=i.toLowerCase();m=0;for(var p=g.length,q;m<p;m++)if(q=g[m]){for(;(q=q.previousSibling)&&q.nodeType!==1;);g[m]=n||q&&q.nodeName.toLowerCase()===
|
||||
i?q||false:q===i}n&&k.filter(i,g,true)},">":function(g,i){var n,m=typeof i==="string",p=0,q=g.length;if(m&&!/\W/.test(i))for(i=i.toLowerCase();p<q;p++){if(n=g[p]){n=n.parentNode;g[p]=n.nodeName.toLowerCase()===i?n:false}}else{for(;p<q;p++)if(n=g[p])g[p]=m?n.parentNode:n.parentNode===i;m&&k.filter(i,g,true)}},"":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=i=i.toLowerCase();q=a}q("parentNode",i,p,g,m,n)},"~":function(g,i,n){var m,p=e++,q=b;if(typeof i==="string"&&!/\W/.test(i)){m=
|
||||
i=i.toLowerCase();q=a}q("previousSibling",i,p,g,m,n)}},find:{ID:function(g,i,n){if(typeof i.getElementById!=="undefined"&&!n)return(g=i.getElementById(g[1]))&&g.parentNode?[g]:[]},NAME:function(g,i){if(typeof i.getElementsByName!=="undefined"){for(var n=[],m=i.getElementsByName(g[1]),p=0,q=m.length;p<q;p++)m[p].getAttribute("name")===g[1]&&n.push(m[p]);return n.length===0?null:n}},TAG:function(g,i){return i.getElementsByTagName(g[1])}},preFilter:{CLASS:function(g,i,n,m,p,q){g=" "+g[1].replace(/\\/g,
|
||||
"")+" ";if(q)return g;q=0;for(var u;(u=i[q])!=null;q++)if(u)if(p^(u.className&&(" "+u.className+" ").replace(/[\t\n]/g," ").indexOf(g)>=0))n||m.push(u);else if(n)i[q]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()},CHILD:function(g){if(g[1]==="nth"){var i=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=i[1]+(i[2]||1)-0;g[3]=i[3]-0}g[0]=e++;return g},ATTR:function(g,i,n,
|
||||
m,p,q){i=g[1].replace(/\\/g,"");if(!q&&o.attrMap[i])g[1]=o.attrMap[i];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,i,n,m,p){if(g[1]==="not")if((d.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,i);else{g=k.filter(g[3],i,n,true^p);n||m.push.apply(m,g);return false}else if(o.match.POS.test(g[0])||o.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===
|
||||
true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,i,n){return!!k(n[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)},text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===
|
||||
g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}},setFilters:{first:function(g,i){return i===0},last:function(g,i,n,m){return i===m.length-1},even:function(g,i){return i%2===0},odd:function(g,i){return i%2===1},lt:function(g,i,n){return i<n[3]-0},gt:function(g,i,n){return i>n[3]-0},nth:function(g,i,n){return n[3]-
|
||||
0===i},eq:function(g,i,n){return n[3]-0===i}},filter:{PSEUDO:function(g,i,n,m){var p=i[1],q=o.filters[p];if(q)return q(g,n,i,m);else if(p==="contains")return(g.textContent||g.innerText||k.getText([g])||"").indexOf(i[3])>=0;else if(p==="not"){i=i[3];n=0;for(m=i.length;n<m;n++)if(i[n]===g)return false;return true}else k.error("Syntax error, unrecognized expression: "+p)},CHILD:function(g,i){var n=i[1],m=g;switch(n){case "only":case "first":for(;m=m.previousSibling;)if(m.nodeType===1)return false;if(n===
|
||||
"first")return true;m=g;case "last":for(;m=m.nextSibling;)if(m.nodeType===1)return false;return true;case "nth":n=i[2];var p=i[3];if(n===1&&p===0)return true;var q=i[0],u=g.parentNode;if(u&&(u.sizcache!==q||!g.nodeIndex)){var y=0;for(m=u.firstChild;m;m=m.nextSibling)if(m.nodeType===1)m.nodeIndex=++y;u.sizcache=q}m=g.nodeIndex-p;return n===0?m===0:m%n===0&&m/n>=0}},ID:function(g,i){return g.nodeType===1&&g.getAttribute("id")===i},TAG:function(g,i){return i==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===
|
||||
i},CLASS:function(g,i){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(i)>-1},ATTR:function(g,i){var n=i[1];n=o.attrHandle[n]?o.attrHandle[n](g):g[n]!=null?g[n]:g.getAttribute(n);var m=n+"",p=i[2],q=i[4];return n==null?p==="!=":p==="="?m===q:p==="*="?m.indexOf(q)>=0:p==="~="?(" "+m+" ").indexOf(q)>=0:!q?m&&n!==false:p==="!="?m!==q:p==="^="?m.indexOf(q)===0:p==="$="?m.substr(m.length-q.length)===q:p==="|="?m===q||m.substr(0,q.length+1)===q+"-":false},POS:function(g,i,n,m){var p=o.setFilters[i[2]];
|
||||
if(p)return p(g,n,i,m)}}},x=o.match.POS,r=function(g,i){return"\\"+(i-0+1)},A;for(A in o.match){o.match[A]=RegExp(o.match[A].source+/(?![^\[]*\])(?![^\(]*\))/.source);o.leftMatch[A]=RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[A].source.replace(/\\(\d+)/g,r))}var C=function(g,i){g=Array.prototype.slice.call(g,0);if(i){i.push.apply(i,g);return i}return g};try{Array.prototype.slice.call(t.documentElement.childNodes,0)}catch(J){C=function(g,i){var n=0,m=i||[];if(f.call(g)==="[object Array]")Array.prototype.push.apply(m,
|
||||
g);else if(typeof g.length==="number")for(var p=g.length;n<p;n++)m.push(g[n]);else for(;g[n];n++)m.push(g[n]);return m}}var w,I;if(t.documentElement.compareDocumentPosition)w=function(g,i){if(g===i){h=true;return 0}if(!g.compareDocumentPosition||!i.compareDocumentPosition)return g.compareDocumentPosition?-1:1;return g.compareDocumentPosition(i)&4?-1:1};else{w=function(g,i){var n,m,p=[],q=[];n=g.parentNode;m=i.parentNode;var u=n;if(g===i){h=true;return 0}else if(n===m)return I(g,i);else if(n){if(!m)return 1}else return-1;
|
||||
for(;u;){p.unshift(u);u=u.parentNode}for(u=m;u;){q.unshift(u);u=u.parentNode}n=p.length;m=q.length;for(u=0;u<n&&u<m;u++)if(p[u]!==q[u])return I(p[u],q[u]);return u===n?I(g,q[u],-1):I(p[u],i,1)};I=function(g,i,n){if(g===i)return n;for(g=g.nextSibling;g;){if(g===i)return-1;g=g.nextSibling}return 1}}k.getText=function(g){for(var i="",n,m=0;g[m];m++){n=g[m];if(n.nodeType===3||n.nodeType===4)i+=n.nodeValue;else if(n.nodeType!==8)i+=k.getText(n.childNodes)}return i};(function(){var g=t.createElement("div"),
|
||||
i="script"+(new Date).getTime(),n=t.documentElement;g.innerHTML="<a name='"+i+"'/>";n.insertBefore(g,n.firstChild);if(t.getElementById(i)){o.find.ID=function(m,p,q){if(typeof p.getElementById!=="undefined"&&!q)return(p=p.getElementById(m[1]))?p.id===m[1]||typeof p.getAttributeNode!=="undefined"&&p.getAttributeNode("id").nodeValue===m[1]?[p]:B:[]};o.filter.ID=function(m,p){var q=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&q&&q.nodeValue===p}}n.removeChild(g);
|
||||
n=g=null})();(function(){var g=t.createElement("div");g.appendChild(t.createComment(""));if(g.getElementsByTagName("*").length>0)o.find.TAG=function(i,n){var m=n.getElementsByTagName(i[1]);if(i[1]==="*"){for(var p=[],q=0;m[q];q++)m[q].nodeType===1&&p.push(m[q]);m=p}return m};g.innerHTML="<a href='#'></a>";if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")o.attrHandle.href=function(i){return i.getAttribute("href",2)};g=null})();t.querySelectorAll&&
|
||||
function(){var g=k,i=t.createElement("div");i.innerHTML="<p class='TEST'></p>";if(!(i.querySelectorAll&&i.querySelectorAll(".TEST").length===0)){k=function(m,p,q,u){p=p||t;m=m.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!u&&!k.isXML(p))if(p.nodeType===9)try{return C(p.querySelectorAll(m),q)}catch(y){}else if(p.nodeType===1&&p.nodeName.toLowerCase()!=="object"){var F=p.getAttribute("id"),M=F||"__sizzle__";F||p.setAttribute("id",M);try{return C(p.querySelectorAll("#"+M+" "+m),q)}catch(N){}finally{F||
|
||||
p.removeAttribute("id")}}return g(m,p,q,u)};for(var n in g)k[n]=g[n];i=null}}();(function(){var g=t.documentElement,i=g.matchesSelector||g.mozMatchesSelector||g.webkitMatchesSelector||g.msMatchesSelector,n=false;try{i.call(t.documentElement,"[test!='']:sizzle")}catch(m){n=true}if(i)k.matchesSelector=function(p,q){q=q.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(p))try{if(n||!o.match.PSEUDO.test(q)&&!/!=/.test(q))return i.call(p,q)}catch(u){}return k(q,null,null,[p]).length>0}})();(function(){var g=
|
||||
t.createElement("div");g.innerHTML="<div class='test e'></div><div class='test'></div>";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){o.order.splice(1,0,"CLASS");o.find.CLASS=function(i,n,m){if(typeof n.getElementsByClassName!=="undefined"&&!m)return n.getElementsByClassName(i[1])};g=null}}})();k.contains=t.documentElement.contains?function(g,i){return g!==i&&(g.contains?g.contains(i):true)}:t.documentElement.compareDocumentPosition?
|
||||
function(g,i){return!!(g.compareDocumentPosition(i)&16)}:function(){return false};k.isXML=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false};var L=function(g,i){for(var n,m=[],p="",q=i.nodeType?[i]:i;n=o.match.PSEUDO.exec(g);){p+=n[0];g=g.replace(o.match.PSEUDO,"")}g=o.relative[g]?g+"*":g;n=0;for(var u=q.length;n<u;n++)k(g,q[n],m);return k.filter(p,m)};c.find=k;c.expr=k.selectors;c.expr[":"]=c.expr.filters;c.unique=k.uniqueSort;c.text=k.getText;c.isXMLDoc=k.isXML;
|
||||
c.contains=k.contains})();var Za=/Until$/,$a=/^(?:parents|prevUntil|prevAll)/,ab=/,/,Na=/^.[^:#\[\.,]*$/,bb=Array.prototype.slice,cb=c.expr.match.POS;c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,e=0,f=this.length;e<f;e++){d=b.length;c.find(a,this[e],b);if(e>0)for(var h=d;h<b.length;h++)for(var l=0;l<d;l++)if(b[l]===b[h]){b.splice(h--,1);break}}return b},has:function(a){var b=c(a);return this.filter(function(){for(var d=0,e=b.length;d<e;d++)if(c.contains(this,b[d]))return true})},
|
||||
not:function(a){return this.pushStack(ma(this,a,false),"not",a)},filter:function(a){return this.pushStack(ma(this,a,true),"filter",a)},is:function(a){return!!a&&c.filter(a,this).length>0},closest:function(a,b){var d=[],e,f,h=this[0];if(c.isArray(a)){var l,k={},o=1;if(h&&a.length){e=0;for(f=a.length;e<f;e++){l=a[e];k[l]||(k[l]=c.expr.match.POS.test(l)?c(l,b||this.context):l)}for(;h&&h.ownerDocument&&h!==b;){for(l in k){e=k[l];if(e.jquery?e.index(h)>-1:c(h).is(e))d.push({selector:l,elem:h,level:o})}h=
|
||||
h.parentNode;o++}}return d}l=cb.test(a)?c(a,b||this.context):null;e=0;for(f=this.length;e<f;e++)for(h=this[e];h;)if(l?l.index(h)>-1:c.find.matchesSelector(h,a)){d.push(h);break}else{h=h.parentNode;if(!h||!h.ownerDocument||h===b)break}d=d.length>1?c.unique(d):d;return this.pushStack(d,"closest",a)},index:function(a){if(!a||typeof a==="string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var d=typeof a==="string"?c(a,b||this.context):
|
||||
c.makeArray(a),e=c.merge(this.get(),d);return this.pushStack(!d[0]||!d[0].parentNode||d[0].parentNode.nodeType===11||!e[0]||!e[0].parentNode||e[0].parentNode.nodeType===11?e:c.unique(e))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode",d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,
|
||||
2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,
|
||||
b){c.fn[a]=function(d,e){var f=c.map(this,b,d);Za.test(a)||(e=d);if(e&&typeof e==="string")f=c.filter(e,f);f=this.length>1?c.unique(f):f;if((this.length>1||ab.test(e))&&$a.test(a))f=f.reverse();return this.pushStack(f,a,bb.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return b.length===1?c.find.matchesSelector(b[0],a)?[b[0]]:[]:c.find.matches(a,b)},dir:function(a,b,d){var e=[];for(a=a[b];a&&a.nodeType!==9&&(d===B||a.nodeType!==1||!c(a).is(d));){a.nodeType===1&&
|
||||
e.push(a);a=a[b]}return e},nth:function(a,b,d){b=b||1;for(var e=0;a;a=a[d])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var za=/ jQuery\d+="(?:\d+|null)"/g,$=/^\s+/,Aa=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Ba=/<([\w:]+)/,db=/<tbody/i,eb=/<|&#?\w+;/,Ca=/<(?:script|object|embed|option|style)/i,Da=/checked\s*(?:[^=]|=\s*.checked.)/i,fb=/\=([^="'>\s]+\/)>/g,P={option:[1,
|
||||
"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};P.optgroup=P.option;P.tbody=P.tfoot=P.colgroup=P.caption=P.thead;P.th=P.td;if(!c.support.htmlSerialize)P._default=[1,"div<div>","</div>"];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d=
|
||||
c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==B)return this.empty().append((this[0]&&this[0].ownerDocument||t).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this},
|
||||
wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})},
|
||||
prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,
|
||||
this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,e;(e=this[d])!=null;d++)if(!a||c.filter(a,[e]).length){if(!b&&e.nodeType===1){c.cleanData(e.getElementsByTagName("*"));c.cleanData([e])}e.parentNode&&e.parentNode.removeChild(e)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild);
|
||||
return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,e=this.ownerDocument;if(!d){d=e.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(za,"").replace(fb,'="$1">').replace($,"")],e)[0]}else return this.cloneNode(true)});if(a===true){na(this,b);na(this.find("*"),b.find("*"))}return b},html:function(a){if(a===B)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(za,""):null;
|
||||
else if(typeof a==="string"&&!Ca.test(a)&&(c.support.leadingWhitespace||!$.test(a))&&!P[(Ba.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Aa,"<$1></$2>");try{for(var b=0,d=this.length;b<d;b++)if(this[b].nodeType===1){c.cleanData(this[b].getElementsByTagName("*"));this[b].innerHTML=a}}catch(e){this.empty().append(a)}}else c.isFunction(a)?this.each(function(f){var h=c(this);h.html(a.call(this,f,h.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(c.isFunction(a))return this.each(function(b){var d=
|
||||
c(this),e=d.html();d.replaceWith(a.call(this,b,e))});if(typeof a!=="string")a=c(a).detach();return this.each(function(){var b=this.nextSibling,d=this.parentNode;c(this).remove();b?c(b).before(a):c(d).append(a)})}else return this.pushStack(c(c.isFunction(a)?a():a),"replaceWith",a)},detach:function(a){return this.remove(a,true)},domManip:function(a,b,d){var e,f,h,l=a[0],k=[];if(!c.support.checkClone&&arguments.length===3&&typeof l==="string"&&Da.test(l))return this.each(function(){c(this).domManip(a,
|
||||
b,d,true)});if(c.isFunction(l))return this.each(function(x){var r=c(this);a[0]=l.call(this,x,b?r.html():B);r.domManip(a,b,d)});if(this[0]){e=l&&l.parentNode;e=c.support.parentNode&&e&&e.nodeType===11&&e.childNodes.length===this.length?{fragment:e}:c.buildFragment(a,this,k);h=e.fragment;if(f=h.childNodes.length===1?h=h.firstChild:h.firstChild){b=b&&c.nodeName(f,"tr");f=0;for(var o=this.length;f<o;f++)d.call(b?c.nodeName(this[f],"table")?this[f].getElementsByTagName("tbody")[0]||this[f].appendChild(this[f].ownerDocument.createElement("tbody")):
|
||||
this[f]:this[f],f>0||e.cacheable||this.length>1?h.cloneNode(true):h)}k.length&&c.each(k,Oa)}return this}});c.buildFragment=function(a,b,d){var e,f,h;b=b&&b[0]?b[0].ownerDocument||b[0]:t;if(a.length===1&&typeof a[0]==="string"&&a[0].length<512&&b===t&&!Ca.test(a[0])&&(c.support.checkClone||!Da.test(a[0]))){f=true;if(h=c.fragments[a[0]])if(h!==1)e=h}if(!e){e=b.createDocumentFragment();c.clean(a,b,e,d)}if(f)c.fragments[a[0]]=h?e:1;return{fragment:e,cacheable:f}};c.fragments={};c.each({appendTo:"append",
|
||||
prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var e=[];d=c(d);var f=this.length===1&&this[0].parentNode;if(f&&f.nodeType===11&&f.childNodes.length===1&&d.length===1){d[b](this[0]);return this}else{f=0;for(var h=d.length;f<h;f++){var l=(f>0?this.clone(true):this).get();c(d[f])[b](l);e=e.concat(l)}return this.pushStack(e,a,d.selector)}}});c.extend({clean:function(a,b,d,e){b=b||t;if(typeof b.createElement==="undefined")b=b.ownerDocument||
|
||||
b[0]&&b[0].ownerDocument||t;for(var f=[],h=0,l;(l=a[h])!=null;h++){if(typeof l==="number")l+="";if(l){if(typeof l==="string"&&!eb.test(l))l=b.createTextNode(l);else if(typeof l==="string"){l=l.replace(Aa,"<$1></$2>");var k=(Ba.exec(l)||["",""])[1].toLowerCase(),o=P[k]||P._default,x=o[0],r=b.createElement("div");for(r.innerHTML=o[1]+l+o[2];x--;)r=r.lastChild;if(!c.support.tbody){x=db.test(l);k=k==="table"&&!x?r.firstChild&&r.firstChild.childNodes:o[1]==="<table>"&&!x?r.childNodes:[];for(o=k.length-
|
||||
1;o>=0;--o)c.nodeName(k[o],"tbody")&&!k[o].childNodes.length&&k[o].parentNode.removeChild(k[o])}!c.support.leadingWhitespace&&$.test(l)&&r.insertBefore(b.createTextNode($.exec(l)[0]),r.firstChild);l=r.childNodes}if(l.nodeType)f.push(l);else f=c.merge(f,l)}}if(d)for(h=0;f[h];h++)if(e&&c.nodeName(f[h],"script")&&(!f[h].type||f[h].type.toLowerCase()==="text/javascript"))e.push(f[h].parentNode?f[h].parentNode.removeChild(f[h]):f[h]);else{f[h].nodeType===1&&f.splice.apply(f,[h+1,0].concat(c.makeArray(f[h].getElementsByTagName("script"))));
|
||||
d.appendChild(f[h])}return f},cleanData:function(a){for(var b,d,e=c.cache,f=c.event.special,h=c.support.deleteExpando,l=0,k;(k=a[l])!=null;l++)if(!(k.nodeName&&c.noData[k.nodeName.toLowerCase()]))if(d=k[c.expando]){if((b=e[d])&&b.events)for(var o in b.events)f[o]?c.event.remove(k,o):c.removeEvent(k,o,b.handle);if(h)delete k[c.expando];else k.removeAttribute&&k.removeAttribute(c.expando);delete e[d]}}});var Ea=/alpha\([^)]*\)/i,gb=/opacity=([^)]*)/,hb=/-([a-z])/ig,ib=/([A-Z])/g,Fa=/^-?\d+(?:px)?$/i,
|
||||
jb=/^-?\d/,kb={position:"absolute",visibility:"hidden",display:"block"},Pa=["Left","Right"],Qa=["Top","Bottom"],W,Ga,aa,lb=function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){if(arguments.length===2&&b===B)return this;return c.access(this,a,b,true,function(d,e,f){return f!==B?c.style(d,e,f):c.css(d,e)})};c.extend({cssHooks:{opacity:{get:function(a,b){if(b){var d=W(a,"opacity","opacity");return d===""?"1":d}else return a.style.opacity}}},cssNumber:{zIndex:true,fontWeight:true,opacity:true,
|
||||
zoom:true,lineHeight:true},cssProps:{"float":c.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,b,d,e){if(!(!a||a.nodeType===3||a.nodeType===8||!a.style)){var f,h=c.camelCase(b),l=a.style,k=c.cssHooks[h];b=c.cssProps[h]||h;if(d!==B){if(!(typeof d==="number"&&isNaN(d)||d==null)){if(typeof d==="number"&&!c.cssNumber[h])d+="px";if(!k||!("set"in k)||(d=k.set(a,d))!==B)try{l[b]=d}catch(o){}}}else{if(k&&"get"in k&&(f=k.get(a,false,e))!==B)return f;return l[b]}}},css:function(a,b,d){var e,f=c.camelCase(b),
|
||||
h=c.cssHooks[f];b=c.cssProps[f]||f;if(h&&"get"in h&&(e=h.get(a,true,d))!==B)return e;else if(W)return W(a,b,f)},swap:function(a,b,d){var e={},f;for(f in b){e[f]=a.style[f];a.style[f]=b[f]}d.call(a);for(f in b)a.style[f]=e[f]},camelCase:function(a){return a.replace(hb,lb)}});c.curCSS=c.css;c.each(["height","width"],function(a,b){c.cssHooks[b]={get:function(d,e,f){var h;if(e){if(d.offsetWidth!==0)h=oa(d,b,f);else c.swap(d,kb,function(){h=oa(d,b,f)});if(h<=0){h=W(d,b,b);if(h==="0px"&&aa)h=aa(d,b,b);
|
||||
if(h!=null)return h===""||h==="auto"?"0px":h}if(h<0||h==null){h=d.style[b];return h===""||h==="auto"?"0px":h}return typeof h==="string"?h:h+"px"}},set:function(d,e){if(Fa.test(e)){e=parseFloat(e);if(e>=0)return e+"px"}else return e}}});if(!c.support.opacity)c.cssHooks.opacity={get:function(a,b){return gb.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var d=a.style;d.zoom=1;var e=c.isNaN(b)?"":"alpha(opacity="+b*100+")",f=
|
||||
d.filter||"";d.filter=Ea.test(f)?f.replace(Ea,e):d.filter+" "+e}};if(t.defaultView&&t.defaultView.getComputedStyle)Ga=function(a,b,d){var e;d=d.replace(ib,"-$1").toLowerCase();if(!(b=a.ownerDocument.defaultView))return B;if(b=b.getComputedStyle(a,null)){e=b.getPropertyValue(d);if(e===""&&!c.contains(a.ownerDocument.documentElement,a))e=c.style(a,d)}return e};if(t.documentElement.currentStyle)aa=function(a,b){var d,e,f=a.currentStyle&&a.currentStyle[b],h=a.style;if(!Fa.test(f)&&jb.test(f)){d=h.left;
|
||||
e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;h.left=b==="fontSize"?"1em":f||0;f=h.pixelLeft+"px";h.left=d;a.runtimeStyle.left=e}return f===""?"auto":f};W=Ga||aa;if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b=a.offsetHeight;return a.offsetWidth===0&&b===0||!c.support.reliableHiddenOffsets&&(a.style.display||c.css(a,"display"))==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var mb=c.now(),nb=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
||||
ob=/^(?:select|textarea)/i,pb=/^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,qb=/^(?:GET|HEAD)$/,Ra=/\[\]$/,T=/\=\?(&|$)/,ja=/\?/,rb=/([?&])_=[^&]*/,sb=/^(\w+:)?\/\/([^\/?#]+)/,tb=/%20/g,ub=/#.*$/,Ha=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!=="string"&&Ha)return Ha.apply(this,arguments);else if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var f=a.slice(e,a.length);a=a.slice(0,e)}e="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b===
|
||||
"object"){b=c.param(b,c.ajaxSettings.traditional);e="POST"}var h=this;c.ajax({url:a,type:e,dataType:"html",data:b,complete:function(l,k){if(k==="success"||k==="notmodified")h.html(f?c("<div>").append(l.responseText.replace(nb,"")).find(f):l.responseText);d&&h.each(d,[l.responseText,k,l])}});return this},serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&
|
||||
!this.disabled&&(this.checked||ob.test(this.nodeName)||pb.test(this.type))}).map(function(a,b){var d=c(this).val();return d==null?null:c.isArray(d)?c.map(d,function(e){return{name:b.name,value:e}}):{name:b.name,value:d}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:e})},
|
||||
getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,e){if(c.isFunction(b)){e=e||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:e})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href,global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:function(){return new E.XMLHttpRequest},accepts:{xml:"application/xml, text/xml",html:"text/html",
|
||||
script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},ajax:function(a){var b=c.extend(true,{},c.ajaxSettings,a),d,e,f,h=b.type.toUpperCase(),l=qb.test(h);b.url=b.url.replace(ub,"");b.context=a&&a.context!=null?a.context:b;if(b.data&&b.processData&&typeof b.data!=="string")b.data=c.param(b.data,b.traditional);if(b.dataType==="jsonp"){if(h==="GET")T.test(b.url)||(b.url+=(ja.test(b.url)?"&":"?")+(b.jsonp||"callback")+"=?");else if(!b.data||
|
||||
!T.test(b.data))b.data=(b.data?b.data+"&":"")+(b.jsonp||"callback")+"=?";b.dataType="json"}if(b.dataType==="json"&&(b.data&&T.test(b.data)||T.test(b.url))){d=b.jsonpCallback||"jsonp"+mb++;if(b.data)b.data=(b.data+"").replace(T,"="+d+"$1");b.url=b.url.replace(T,"="+d+"$1");b.dataType="script";var k=E[d];E[d]=function(m){if(c.isFunction(k))k(m);else{E[d]=B;try{delete E[d]}catch(p){}}f=m;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);r&&r.removeChild(A)}}if(b.dataType==="script"&&b.cache===null)b.cache=
|
||||
false;if(b.cache===false&&l){var o=c.now(),x=b.url.replace(rb,"$1_="+o);b.url=x+(x===b.url?(ja.test(b.url)?"&":"?")+"_="+o:"")}if(b.data&&l)b.url+=(ja.test(b.url)?"&":"?")+b.data;b.global&&c.active++===0&&c.event.trigger("ajaxStart");o=(o=sb.exec(b.url))&&(o[1]&&o[1].toLowerCase()!==location.protocol||o[2].toLowerCase()!==location.host);if(b.dataType==="script"&&h==="GET"&&o){var r=t.getElementsByTagName("head")[0]||t.documentElement,A=t.createElement("script");if(b.scriptCharset)A.charset=b.scriptCharset;
|
||||
A.src=b.url;if(!d){var C=false;A.onload=A.onreadystatechange=function(){if(!C&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){C=true;c.handleSuccess(b,w,e,f);c.handleComplete(b,w,e,f);A.onload=A.onreadystatechange=null;r&&A.parentNode&&r.removeChild(A)}}}r.insertBefore(A,r.firstChild);return B}var J=false,w=b.xhr();if(w){b.username?w.open(h,b.url,b.async,b.username,b.password):w.open(h,b.url,b.async);try{if(b.data!=null&&!l||a&&a.contentType)w.setRequestHeader("Content-Type",
|
||||
b.contentType);if(b.ifModified){c.lastModified[b.url]&&w.setRequestHeader("If-Modified-Since",c.lastModified[b.url]);c.etag[b.url]&&w.setRequestHeader("If-None-Match",c.etag[b.url])}o||w.setRequestHeader("X-Requested-With","XMLHttpRequest");w.setRequestHeader("Accept",b.dataType&&b.accepts[b.dataType]?b.accepts[b.dataType]+", */*; q=0.01":b.accepts._default)}catch(I){}if(b.beforeSend&&b.beforeSend.call(b.context,w,b)===false){b.global&&c.active--===1&&c.event.trigger("ajaxStop");w.abort();return false}b.global&&
|
||||
c.triggerGlobal(b,"ajaxSend",[w,b]);var L=w.onreadystatechange=function(m){if(!w||w.readyState===0||m==="abort"){J||c.handleComplete(b,w,e,f);J=true;if(w)w.onreadystatechange=c.noop}else if(!J&&w&&(w.readyState===4||m==="timeout")){J=true;w.onreadystatechange=c.noop;e=m==="timeout"?"timeout":!c.httpSuccess(w)?"error":b.ifModified&&c.httpNotModified(w,b.url)?"notmodified":"success";var p;if(e==="success")try{f=c.httpData(w,b.dataType,b)}catch(q){e="parsererror";p=q}if(e==="success"||e==="notmodified")d||
|
||||
c.handleSuccess(b,w,e,f);else c.handleError(b,w,e,p);d||c.handleComplete(b,w,e,f);m==="timeout"&&w.abort();if(b.async)w=null}};try{var g=w.abort;w.abort=function(){w&&Function.prototype.call.call(g,w);L("abort")}}catch(i){}b.async&&b.timeout>0&&setTimeout(function(){w&&!J&&L("timeout")},b.timeout);try{w.send(l||b.data==null?null:b.data)}catch(n){c.handleError(b,w,null,n);c.handleComplete(b,w,e,f)}b.async||L();return w}},param:function(a,b){var d=[],e=function(h,l){l=c.isFunction(l)?l():l;d[d.length]=
|
||||
encodeURIComponent(h)+"="+encodeURIComponent(l)};if(b===B)b=c.ajaxSettings.traditional;if(c.isArray(a)||a.jquery)c.each(a,function(){e(this.name,this.value)});else for(var f in a)da(f,a[f],b,e);return d.join("&").replace(tb,"+")}});c.extend({active:0,lastModified:{},etag:{},handleError:function(a,b,d,e){a.error&&a.error.call(a.context,b,d,e);a.global&&c.triggerGlobal(a,"ajaxError",[b,a,e])},handleSuccess:function(a,b,d,e){a.success&&a.success.call(a.context,e,d,b);a.global&&c.triggerGlobal(a,"ajaxSuccess",
|
||||
[b,a])},handleComplete:function(a,b,d){a.complete&&a.complete.call(a.context,b,d);a.global&&c.triggerGlobal(a,"ajaxComplete",[b,a]);a.global&&c.active--===1&&c.event.trigger("ajaxStop")},triggerGlobal:function(a,b,d){(a.context&&a.context.url==null?c(a.context):c.event).trigger(b,d)},httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status===1223}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),
|
||||
e=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(e)c.etag[b]=e;return a.status===304},httpData:function(a,b,d){var e=a.getResponseHeader("content-type")||"",f=b==="xml"||!b&&e.indexOf("xml")>=0;a=f?a.responseXML:a.responseText;f&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b==="json"||!b&&e.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&e.indexOf("javascript")>=0)c.globalEval(a);return a}});
|
||||
if(E.ActiveXObject)c.ajaxSettings.xhr=function(){if(E.location.protocol!=="file:")try{return new E.XMLHttpRequest}catch(a){}try{return new E.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}};c.support.ajax=!!c.ajaxSettings.xhr();var ea={},vb=/^(?:toggle|show|hide)$/,wb=/^([+\-]=)?([\d+.\-]+)(.*)$/,ba,pa=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b,d){if(a||a===0)return this.animate(S("show",
|
||||
3),a,b,d);else{d=0;for(var e=this.length;d<e;d++){a=this[d];b=a.style.display;if(!c.data(a,"olddisplay")&&b==="none")b=a.style.display="";b===""&&c.css(a,"display")==="none"&&c.data(a,"olddisplay",qa(a.nodeName))}for(d=0;d<e;d++){a=this[d];b=a.style.display;if(b===""||b==="none")a.style.display=c.data(a,"olddisplay")||""}return this}},hide:function(a,b,d){if(a||a===0)return this.animate(S("hide",3),a,b,d);else{a=0;for(b=this.length;a<b;a++){d=c.css(this[a],"display");d!=="none"&&c.data(this[a],"olddisplay",
|
||||
d)}for(a=0;a<b;a++)this[a].style.display="none";return this}},_toggle:c.fn.toggle,toggle:function(a,b,d){var e=typeof a==="boolean";if(c.isFunction(a)&&c.isFunction(b))this._toggle.apply(this,arguments);else a==null||e?this.each(function(){var f=e?a:c(this).is(":hidden");c(this)[f?"show":"hide"]()}):this.animate(S("toggle",3),a,b,d);return this},fadeTo:function(a,b,d,e){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,d,e)},animate:function(a,b,d,e){var f=c.speed(b,
|
||||
d,e);if(c.isEmptyObject(a))return this.each(f.complete);return this[f.queue===false?"each":"queue"](function(){var h=c.extend({},f),l,k=this.nodeType===1,o=k&&c(this).is(":hidden"),x=this;for(l in a){var r=c.camelCase(l);if(l!==r){a[r]=a[l];delete a[l];l=r}if(a[l]==="hide"&&o||a[l]==="show"&&!o)return h.complete.call(this);if(k&&(l==="height"||l==="width")){h.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY];if(c.css(this,"display")==="inline"&&c.css(this,"float")==="none")if(c.support.inlineBlockNeedsLayout)if(qa(this.nodeName)===
|
||||
"inline")this.style.display="inline-block";else{this.style.display="inline";this.style.zoom=1}else this.style.display="inline-block"}if(c.isArray(a[l])){(h.specialEasing=h.specialEasing||{})[l]=a[l][1];a[l]=a[l][0]}}if(h.overflow!=null)this.style.overflow="hidden";h.curAnim=c.extend({},a);c.each(a,function(A,C){var J=new c.fx(x,h,A);if(vb.test(C))J[C==="toggle"?o?"show":"hide":C](a);else{var w=wb.exec(C),I=J.cur()||0;if(w){var L=parseFloat(w[2]),g=w[3]||"px";if(g!=="px"){c.style(x,A,(L||1)+g);I=(L||
|
||||
1)/J.cur()*I;c.style(x,A,I+g)}if(w[1])L=(w[1]==="-="?-1:1)*L+I;J.custom(I,L,g)}else J.custom(I,C,"")}});return true})},stop:function(a,b){var d=c.timers;a&&this.queue([]);this.each(function(){for(var e=d.length-1;e>=0;e--)if(d[e].elem===this){b&&d[e](true);d.splice(e,1)}});b||this.dequeue();return this}});c.each({slideDown:S("show",1),slideUp:S("hide",1),slideToggle:S("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){c.fn[a]=function(d,e,f){return this.animate(b,
|
||||
d,e,f)}});c.extend({speed:function(a,b,d){var e=a&&typeof a==="object"?c.extend({},a):{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};e.duration=c.fx.off?0:typeof e.duration==="number"?e.duration:e.duration in c.fx.speeds?c.fx.speeds[e.duration]:c.fx.speeds._default;e.old=e.complete;e.complete=function(){e.queue!==false&&c(this).dequeue();c.isFunction(e.old)&&e.old.call(this)};return e},easing:{linear:function(a,b,d,e){return d+e*a},swing:function(a,b,d,e){return(-Math.cos(a*
|
||||
Math.PI)/2+0.5)*e+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]||c.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a=parseFloat(c.css(this.elem,this.prop));return a&&a>-1E4?a:0},custom:function(a,b,d){function e(l){return f.step(l)}
|
||||
var f=this,h=c.fx;this.startTime=c.now();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start;this.pos=this.state=0;e.elem=this.elem;if(e()&&c.timers.push(e)&&!ba)ba=setInterval(h.tick,h.interval)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;
|
||||
this.custom(this.cur(),0)},step:function(a){var b=c.now(),d=true;if(a||b>=this.options.duration+this.startTime){this.now=this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var e in this.options.curAnim)if(this.options.curAnim[e]!==true)d=false;if(d){if(this.options.overflow!=null&&!c.support.shrinkWrapBlocks){var f=this.elem,h=this.options;c.each(["","X","Y"],function(k,o){f.style["overflow"+o]=h.overflow[k]})}this.options.hide&&c(this.elem).hide();if(this.options.hide||
|
||||
this.options.show)for(var l in this.options.curAnim)c.style(this.elem,l,this.options.orig[l]);this.options.complete.call(this.elem)}return false}else{a=b-this.startTime;this.state=a/this.options.duration;b=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||b](this.state,a,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=
|
||||
c.timers,b=0;b<a.length;b++)a[b]()||a.splice(b--,1);a.length||c.fx.stop()},interval:13,stop:function(){clearInterval(ba);ba=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){c.style(a.elem,"opacity",a.now)},_default:function(a){if(a.elem.style&&a.elem.style[a.prop]!=null)a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit;else a.elem[a.prop]=a.now}}});if(c.expr&&c.expr.filters)c.expr.filters.animated=function(a){return c.grep(c.timers,function(b){return a===
|
||||
b.elem}).length};var xb=/^t(?:able|d|h)$/i,Ia=/^(?:body|html)$/i;c.fn.offset="getBoundingClientRect"in t.documentElement?function(a){var b=this[0],d;if(a)return this.each(function(l){c.offset.setOffset(this,a,l)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);try{d=b.getBoundingClientRect()}catch(e){}var f=b.ownerDocument,h=f.documentElement;if(!d||!c.contains(h,b))return d||{top:0,left:0};b=f.body;f=fa(f);return{top:d.top+(f.pageYOffset||c.support.boxModel&&
|
||||
h.scrollTop||b.scrollTop)-(h.clientTop||b.clientTop||0),left:d.left+(f.pageXOffset||c.support.boxModel&&h.scrollLeft||b.scrollLeft)-(h.clientLeft||b.clientLeft||0)}}:function(a){var b=this[0];if(a)return this.each(function(x){c.offset.setOffset(this,a,x)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return c.offset.bodyOffset(b);c.offset.initialize();var d,e=b.offsetParent,f=b.ownerDocument,h=f.documentElement,l=f.body;d=(f=f.defaultView)?f.getComputedStyle(b,null):b.currentStyle;
|
||||
for(var k=b.offsetTop,o=b.offsetLeft;(b=b.parentNode)&&b!==l&&b!==h;){if(c.offset.supportsFixedPosition&&d.position==="fixed")break;d=f?f.getComputedStyle(b,null):b.currentStyle;k-=b.scrollTop;o-=b.scrollLeft;if(b===e){k+=b.offsetTop;o+=b.offsetLeft;if(c.offset.doesNotAddBorder&&!(c.offset.doesAddBorderForTableAndCells&&xb.test(b.nodeName))){k+=parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}e=b.offsetParent}if(c.offset.subtractsBorderForOverflowNotVisible&&d.overflow!=="visible"){k+=
|
||||
parseFloat(d.borderTopWidth)||0;o+=parseFloat(d.borderLeftWidth)||0}d=d}if(d.position==="relative"||d.position==="static"){k+=l.offsetTop;o+=l.offsetLeft}if(c.offset.supportsFixedPosition&&d.position==="fixed"){k+=Math.max(h.scrollTop,l.scrollTop);o+=Math.max(h.scrollLeft,l.scrollLeft)}return{top:k,left:o}};c.offset={initialize:function(){var a=t.body,b=t.createElement("div"),d,e,f,h=parseFloat(c.css(a,"marginTop"))||0;c.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",
|
||||
height:"1px",visibility:"hidden"});b.innerHTML="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";a.insertBefore(b,a.firstChild);d=b.firstChild;e=d.firstChild;f=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=e.offsetTop!==5;this.doesAddBorderForTableAndCells=
|
||||
f.offsetTop===5;e.style.position="fixed";e.style.top="20px";this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15;e.style.position=e.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==h;a.removeChild(b);c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.css(a,
|
||||
"marginTop"))||0;d+=parseFloat(c.css(a,"marginLeft"))||0}return{top:b,left:d}},setOffset:function(a,b,d){var e=c.css(a,"position");if(e==="static")a.style.position="relative";var f=c(a),h=f.offset(),l=c.css(a,"top"),k=c.css(a,"left"),o=e==="absolute"&&c.inArray("auto",[l,k])>-1;e={};var x={};if(o)x=f.position();l=o?x.top:parseInt(l,10)||0;k=o?x.left:parseInt(k,10)||0;if(c.isFunction(b))b=b.call(a,d,h);if(b.top!=null)e.top=b.top-h.top+l;if(b.left!=null)e.left=b.left-h.left+k;"using"in b?b.using.call(a,
|
||||
e):f.css(e)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),e=Ia.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.css(a,"marginTop"))||0;d.left-=parseFloat(c.css(a,"marginLeft"))||0;e.top+=parseFloat(c.css(b[0],"borderTopWidth"))||0;e.left+=parseFloat(c.css(b[0],"borderLeftWidth"))||0;return{top:d.top-e.top,left:d.left-e.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||t.body;a&&!Ia.test(a.nodeName)&&
|
||||
c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(e){var f=this[0],h;if(!f)return null;if(e!==B)return this.each(function(){if(h=fa(this))h.scrollTo(!a?e:c(h).scrollLeft(),a?e:c(h).scrollTop());else this[d]=e});else return(h=fa(f))?"pageXOffset"in h?h[a?"pageYOffset":"pageXOffset"]:c.support.boxModel&&h.document.documentElement[d]||h.document.body[d]:f[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();
|
||||
c.fn["inner"+b]=function(){return this[0]?parseFloat(c.css(this[0],d,"padding")):null};c.fn["outer"+b]=function(e){return this[0]?parseFloat(c.css(this[0],d,e?"margin":"border")):null};c.fn[d]=function(e){var f=this[0];if(!f)return e==null?null:this;if(c.isFunction(e))return this.each(function(l){var k=c(this);k[d](e.call(this,l,k[d]()))});if(c.isWindow(f))return f.document.compatMode==="CSS1Compat"&&f.document.documentElement["client"+b]||f.document.body["client"+b];else if(f.nodeType===9)return Math.max(f.documentElement["client"+
|
||||
b],f.body["scroll"+b],f.documentElement["scroll"+b],f.body["offset"+b],f.documentElement["offset"+b]);else if(e===B){f=c.css(f,d);var h=parseFloat(f);return c.isNaN(h)?f:h}else return this.css(d,typeof e==="string"?e:e+"px")}})})(window);
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
367
bower_components/jsdom/test/jsdom/env.js
vendored
367
bower_components/jsdom/test/jsdom/env.js
vendored
@ -1,367 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var env = require("../..").env;
|
||||
var path = require("path");
|
||||
var http = require("http");
|
||||
var fs = require("fs");
|
||||
var toFileUrl = require("../util").toFileUrl(__dirname);
|
||||
|
||||
exports["with invalid arguments"] = function (t) {
|
||||
t.throws(function () { jsdom.env(); });
|
||||
t.throws(function () { jsdom.env({}); });
|
||||
t.throws(function () { jsdom.env({ html: "abc123" }); });
|
||||
t.throws(function () { jsdom.env({ done: function () {} }); });
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["explicit config.html, full document"] = function (t) {
|
||||
env({
|
||||
html: "<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>",
|
||||
url: "http://example.com/",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, "<html><head><title>Hi</title></head><body>Hello</body></html>");
|
||||
t.equal(window.location.href, "http://example.com/");
|
||||
t.equal(window.location.origin, "http://example.com");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, with overriden config.url"] = function (t) {
|
||||
env({
|
||||
html: "Hello",
|
||||
url: "http://example.com/",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, "<html><body>Hello</body></html>");
|
||||
t.equal(window.location.href, "http://example.com/");
|
||||
t.equal(window.location.origin, "http://example.com");
|
||||
t.equal(window.location.search, "");
|
||||
t.equal(window.location.hash, "");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, with overriden config.url including hash"] = function (t) {
|
||||
env({
|
||||
html: "Hello",
|
||||
url: "http://example.com/#foo",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.location.hash, "#foo");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, with overriden config.url including search and hash"] = function (t) {
|
||||
env({
|
||||
html: "Hello",
|
||||
url: "http://example.com/?foo=bar#baz",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.location.search, "?foo=bar");
|
||||
t.equal(window.location.hash, "#baz");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, without a config.url"] = function (t) {
|
||||
env({
|
||||
html: "<html><body><p>hello world!</p></body></html>",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.notEqual(window.location.href, null);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, with poorly formatted HTML"] = function (t) {
|
||||
env({
|
||||
html: "some poorly<div>formed<b>html</div> fragment",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.notEqual(window.location.href, null);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, a string that is also a valid URL"] = function (t) {
|
||||
env({
|
||||
html: "http://example.com/",
|
||||
url: "http://example.com/",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, "<html><body>http://example.com/</body></html>");
|
||||
t.equal(window.location.href, "http://example.com/");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.html, a string that is also a valid file"] = function (t) {
|
||||
var body = path.resolve(__dirname, "files/env.html");
|
||||
env({
|
||||
html: body,
|
||||
url: "http://example.com/",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, "<html><body>" + body + "</body></html>");
|
||||
t.equal(window.location.href, "http://example.com/");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.url, valid"] = function (t) {
|
||||
var html = "<html><head><title>Example URL</title></head><body>Example!</body></html>";
|
||||
var responseText = "<!DOCTYPE html>" + html;
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.writeHead(200, { "Content-Length": responseText.length });
|
||||
res.end(responseText);
|
||||
server.close();
|
||||
}).listen(8976);
|
||||
|
||||
env({
|
||||
url: "http://localhost:8976/",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, html);
|
||||
t.equal(window.location.href, "http://localhost:8976/");
|
||||
t.equal(window.location.origin, "http://localhost:8976");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.url, invalid"] = function (t) {
|
||||
env({
|
||||
url: "http://localhost:8976",
|
||||
done: function (err, window) {
|
||||
t.ok(err, 'an error should exist');
|
||||
t.strictEqual(window, undefined, 'window should not exist');
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.file, valid"] = function (t) {
|
||||
var fileName = path.resolve(__dirname, "files/env.html");
|
||||
|
||||
fs.readFile(fileName, 'utf-8', function (err, text) {
|
||||
t.ifError(err);
|
||||
env({
|
||||
file: fileName,
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.doctype + window.document.innerHTML, text);
|
||||
t.equal(window.location.href, toFileUrl(fileName));
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.file, invalid"] = function (t) {
|
||||
env({
|
||||
file: "__DOES_NOT_EXIST__",
|
||||
done: function (err, window) {
|
||||
t.ok(err, 'an error should exist');
|
||||
t.strictEqual(window, undefined, 'window should not exist');
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.file, with a script"] = function (t) {
|
||||
env({
|
||||
file: path.resolve(__dirname, "files/env.html"),
|
||||
scripts: [path.resolve(__dirname, "../jquery-fixtures/jquery-1.6.2.js")],
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
|
||||
var $ = window.jQuery;
|
||||
var text = "Let's Rock!";
|
||||
|
||||
$("body").text(text);
|
||||
|
||||
t.equal($("body").text(), text);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["explicit config.file, with spaces in the file name"] = function (t) {
|
||||
var fileName = path.resolve(__dirname, "files/folder space/space.html");
|
||||
|
||||
env({
|
||||
file: fileName,
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["string, parseable as a URL, valid"] = function (t) {
|
||||
var html = "<html><head><title>Example URL</title></head><body>Example!</body></html>";
|
||||
var responseText = "<!DOCTYPE html>" + html;
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.writeHead(200, { "Content-Length": responseText.length });
|
||||
res.end(responseText);
|
||||
server.close();
|
||||
}).listen(8976);
|
||||
|
||||
env(
|
||||
"http://localhost:8976/",
|
||||
function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, html);
|
||||
t.equal(window.location.href, "http://localhost:8976/");
|
||||
t.equal(window.location.origin, "http://localhost:8976");
|
||||
t.done();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports["string, parseable as a URL, invalid"] = function (t) {
|
||||
env(
|
||||
"http://localhost:8976",
|
||||
function (err, window) {
|
||||
t.ok(err, 'an error should exist');
|
||||
t.strictEqual(window, undefined, 'window should not exist');
|
||||
t.done();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports["string, for an existing filename"] = function (t) {
|
||||
var fileName = path.resolve(__dirname, "files/env.html");
|
||||
|
||||
fs.readFile(fileName, 'utf-8', function (err, text) {
|
||||
t.ifError(err);
|
||||
env(
|
||||
fileName,
|
||||
function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.doctype + window.document.innerHTML, text);
|
||||
t.equal(window.location.href, toFileUrl(fileName));
|
||||
t.done();
|
||||
}
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
exports["string, does not exist as a file"] = function (t) {
|
||||
var body = "__DOES_NOT_EXIST__";
|
||||
|
||||
env(
|
||||
body,
|
||||
function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, "<html><body>" + body + "</body></html>");
|
||||
t.done();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports["string, full HTML document"] = function (t) {
|
||||
env(
|
||||
"<!DOCTYPE html><html><head><title>Hi</title></head><body>Hello</body></html>",
|
||||
function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.innerHTML, "<html><head><title>Hi</title></head><body>Hello</body></html>");
|
||||
t.done();
|
||||
}
|
||||
);
|
||||
};
|
||||
|
||||
exports["with a nonexistant script"] = function (t) {
|
||||
env({
|
||||
html: "<!DOCTYPE html><html><body><p>hello world!</p></body></html>",
|
||||
scripts: ["path/to/invalid.js", "another/invalid.js"],
|
||||
done: function (err, window) {
|
||||
t.ok(err);
|
||||
t.equal(err.length, 2);
|
||||
t.ok(window.location.href);
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["with src"] = function (t) {
|
||||
env({
|
||||
html: "<!DOCTYPE html><html><body><p>hello world!</p></body></html>",
|
||||
src: "window.attachedHere = 123;",
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.ok(window.location.href);
|
||||
t.equal(window.attachedHere, 123);
|
||||
t.equal(window.document.getElementsByTagName("p").item(0).innerHTML, "hello world!");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["with document referrer"] = function (t) {
|
||||
env({
|
||||
html: "<!DOCTYPE html><html><body><p>hello world!</p></body></html>",
|
||||
document: { referrer: "https://github.com/tmpvar/jsdom" },
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.referrer, "https://github.com/tmpvar/jsdom");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["with document cookie"] = function (t) {
|
||||
var time = new Date(Date.now() + 24 * 60 * 60 * 1000);
|
||||
var cookie = "key=value; expires=" + time.toGMTString() + "; path=/";
|
||||
|
||||
env({
|
||||
html: "<!DOCTYPE html><html><body><p>hello world!</p></body></html>",
|
||||
document: { cookie: cookie },
|
||||
done: function (err, window) {
|
||||
t.ifError(err);
|
||||
t.equal(window.document.cookie, "key=value");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
exports["with scripts and content retrieved from URLs"] = function (t) {
|
||||
var routes = {
|
||||
"/js": "window.attachedHere = 123;",
|
||||
"/html": "<a href='/path/to/hello'>World</a>"
|
||||
};
|
||||
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.writeHead(200, { "Content-Length": routes[req.url].length });
|
||||
res.end(routes[req.url]);
|
||||
});
|
||||
|
||||
server.listen(64000, "127.0.0.1", function () {
|
||||
env({
|
||||
url: "http://127.0.0.1:64000/html",
|
||||
scripts: "http://127.0.0.1:64000/js",
|
||||
done: function (err, window) {
|
||||
server.close();
|
||||
|
||||
t.ifError(err);
|
||||
t.equal(window.location.href, "http://127.0.0.1:64000/html");
|
||||
t.equal(window.location.origin, "http://127.0.0.1:64000");
|
||||
t.equal(window.attachedHere, 123);
|
||||
t.equal(window.document.getElementsByTagName("a").item(0).innerHTML, "World");
|
||||
t.done();
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
@ -1,46 +0,0 @@
|
||||
var test = function (v, n) {
|
||||
try {
|
||||
assert.ok(v, n);
|
||||
}
|
||||
catch (e) {
|
||||
console.log(e.name + ': ' + e.message);
|
||||
return;
|
||||
}
|
||||
console.log('OK: ' + n);
|
||||
};
|
||||
|
||||
console.log('\nIN script.js');
|
||||
|
||||
console.log('this: \t\t', this);
|
||||
console.log('window: \t', window);
|
||||
this.g && console.log('g(): \t\t', g());
|
||||
|
||||
test('a' in this, '"a" in this');
|
||||
test('a' in window, '"a" in window');
|
||||
test(a === 1, 'a === 1');
|
||||
test(window.a === 1, 'window.a === 1');
|
||||
test(this.a === 1, 'this.a === 1');
|
||||
|
||||
|
||||
a = 101;
|
||||
test(window.a === 101, 'window.a === 101');
|
||||
test(this.a === 101, 'this.a === 101')
|
||||
|
||||
|
||||
window.b = 102;
|
||||
test(b === 102, 'b === 102');
|
||||
test(this.b === 102, 'this.b === 102');
|
||||
|
||||
|
||||
var c = 103;
|
||||
test(window.c === 103, 'window.c === 103');
|
||||
test(this.c === 103, 'this.c === 103');
|
||||
|
||||
|
||||
this.d = 104;
|
||||
test(d === 104, 'd === 104');
|
||||
test(window.d === 104, 'window.d === 104');
|
||||
|
||||
|
||||
Object.prototype.e = 1;
|
||||
test({}.e === 1, '{}.e === 1');
|
@ -1,24 +0,0 @@
|
||||
console.log('\nIN script2.js');
|
||||
|
||||
console.log('this: \t\t', this);
|
||||
console.log('window: \t', window);
|
||||
this.g && console.log('g(): \t\t', g());
|
||||
|
||||
test(a === 101, 'a === 101');
|
||||
test(window.a === 101, 'window.a === 101');
|
||||
test(this.a === 101, 'this.a === 101');
|
||||
|
||||
test(b === 102, 'b === 102');
|
||||
test(window.b === 102, 'window.b === 102');
|
||||
test(this.b === 102, 'this.b === 102');
|
||||
|
||||
test(c === 103, 'c === 103');
|
||||
test(window.c === 103, 'window.c === 103');
|
||||
test(this.c === 103, 'this.c === 103');
|
||||
test('c' in this, '"c" in this');
|
||||
|
||||
test(d === 104, 'd === 104');
|
||||
test(window.d === 104, 'window.d === 104');
|
||||
test(this.d === 104, 'this.d === 104');
|
||||
|
||||
test({}.e === 1, '{}.e === 1');
|
@ -1,23 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
var a = 1;
|
||||
var b = 2;
|
||||
|
||||
var assert = {
|
||||
ok: function (v, n) {
|
||||
if (!v) throw new { name: 'AssertionError', message: n };
|
||||
}
|
||||
};
|
||||
</script>
|
||||
|
||||
<script src="ctx-script1.js"></script>
|
||||
<script src="ctx-script2.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
@ -1,457 +0,0 @@
|
||||
/*!
|
||||
* =======================================================
|
||||
* Ender: open module JavaScript framework
|
||||
* copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
|
||||
* https://ender.no.de
|
||||
* License MIT
|
||||
* Module's individual licenses still apply
|
||||
* Build: ender build qwery
|
||||
* =======================================================
|
||||
*/
|
||||
|
||||
/*!
|
||||
* Ender-JS: open module JavaScript framework (client-lib)
|
||||
* copyright Dustin Diaz & Jacob Thornton 2011 (@ded @fat)
|
||||
* https://ender.no.de
|
||||
* License MIT
|
||||
*/
|
||||
!function (context) {
|
||||
|
||||
// Implements simple module system
|
||||
// losely based on CommonJS Modules spec v1.1.1
|
||||
// ============================================
|
||||
|
||||
var modules = {};
|
||||
|
||||
function require (identifier) {
|
||||
var module = modules[identifier] || window[identifier];
|
||||
if (!module) throw new Error("Requested module has not been defined.");
|
||||
return module;
|
||||
}
|
||||
|
||||
function provide (name, what) {
|
||||
return modules[name] = what;
|
||||
}
|
||||
|
||||
context['provide'] = provide;
|
||||
context['require'] = require;
|
||||
|
||||
// Implements Ender's $ global access object
|
||||
// =========================================
|
||||
|
||||
function aug(o, o2) {
|
||||
for (var k in o2) {
|
||||
k != 'noConflict' && k != '_VERSION' && (o[k] = o2[k]);
|
||||
}
|
||||
return o;
|
||||
}
|
||||
|
||||
function boosh(s, r, els) {
|
||||
// string || node || nodelist || window
|
||||
if (ender._select && (typeof s == 'string' || s.nodeName || s.length && 'item' in s || s == window)) {
|
||||
els = ender._select(s, r);
|
||||
els.selector = s;
|
||||
} else {
|
||||
els = isFinite(s.length) ? s : [s];
|
||||
}
|
||||
return aug(els, boosh);
|
||||
}
|
||||
|
||||
function ender(s, r) {
|
||||
return boosh(s, r);
|
||||
}
|
||||
|
||||
aug(ender, {
|
||||
_VERSION: '0.2.5',
|
||||
ender: function (o, chain) {
|
||||
aug(chain ? boosh : ender, o);
|
||||
},
|
||||
fn: context.$ && context.$.fn || {} // for easy compat to jQuery plugins
|
||||
});
|
||||
|
||||
aug(boosh, {
|
||||
forEach: function (fn, scope, i) {
|
||||
// opt out of native forEach so we can intentionally call our own scope
|
||||
// defaulting to the current item and be able to return self
|
||||
for (i = 0, l = this.length; i < l; ++i) {
|
||||
i in this && fn.call(scope || this[i], this[i], i, this);
|
||||
}
|
||||
// return self for chaining
|
||||
return this;
|
||||
},
|
||||
$: ender // handy reference to self
|
||||
});
|
||||
|
||||
var old = context.$;
|
||||
ender.noConflict = function () {
|
||||
context.$ = old;
|
||||
return this;
|
||||
};
|
||||
|
||||
(typeof module !== 'undefined') && module.exports && (module.exports = ender);
|
||||
// use subscript notation as extern for Closure compilation
|
||||
context['ender'] = context['$'] = ender;
|
||||
|
||||
}(this);
|
||||
|
||||
!function () {
|
||||
|
||||
var module = { exports: {} }, exports = module.exports;
|
||||
|
||||
/*!
|
||||
* Qwery - A Blazing Fast query selector engine
|
||||
* https://github.com/ded/qwery
|
||||
* copyright Dustin Diaz & Jacob Thornton 2011
|
||||
* MIT License
|
||||
*/
|
||||
|
||||
!function (context, doc) {
|
||||
|
||||
var c, i, j, k, l, m, o, p, r, v,
|
||||
el, node, len, found, classes, item, items, token,
|
||||
html = doc.documentElement,
|
||||
id = /#([\w\-]+)/,
|
||||
clas = /\.[\w\-]+/g,
|
||||
idOnly = /^#([\w\-]+$)/,
|
||||
classOnly = /^\.([\w\-]+)$/,
|
||||
tagOnly = /^([\w\-]+)$/,
|
||||
tagAndOrClass = /^([\w]+)?\.([\w\-]+)$/,
|
||||
normalizr = /\s*([\s\+\~>])\s*/g,
|
||||
splitters = /[\s\>\+\~]/,
|
||||
splittersMore = /(?![\s\w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^'"]*\])/,
|
||||
dividers = new RegExp('(' + splitters.source + ')' + splittersMore.source, 'g'),
|
||||
tokenizr = new RegExp(splitters.source + splittersMore.source),
|
||||
specialChars = /([.*+?\^=!:${}()|\[\]\/\\])/g,
|
||||
simple = /^([a-z0-9]+)?(?:([\.\#]+[\w\-\.#]+)?)/,
|
||||
attr = /\[([\w\-]+)(?:([\|\^\$\*\~]?\=)['"]?([ \w\-\/\?\&\=\:\.\(\)\!,@#%<>\{\}\$\*\^]+)["']?)?\]/,
|
||||
pseudo = /:([\w\-]+)(\(['"]?(\w+)['"]?\))?/,
|
||||
chunker = new RegExp(simple.source + '(' + attr.source + ')?' + '(' + pseudo.source + ')?'),
|
||||
walker = {
|
||||
' ': function (node) {
|
||||
return node && node !== html && node.parentNode
|
||||
},
|
||||
'>': function (node, contestant) {
|
||||
return node && node.parentNode == contestant.parentNode && node.parentNode;
|
||||
},
|
||||
'~': function (node) {
|
||||
return node && node.previousSibling;
|
||||
},
|
||||
'+': function (node, contestant, p1, p2) {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
p1 = previous(node);
|
||||
p2 = previous(contestant);
|
||||
return p1 && p2 && p1 == p2 && p1;
|
||||
}
|
||||
};
|
||||
function cache() {
|
||||
this.c = {};
|
||||
}
|
||||
cache.prototype = {
|
||||
g: function (k) {
|
||||
return this.c[k] || undefined;
|
||||
},
|
||||
s: function (k, v) {
|
||||
this.c[k] = v;
|
||||
return v;
|
||||
}
|
||||
};
|
||||
|
||||
var classCache = new cache(),
|
||||
cleanCache = new cache(),
|
||||
attrCache = new cache(),
|
||||
tokenCache = new cache();
|
||||
|
||||
function array(ar) {
|
||||
r = [];
|
||||
for (i = 0, len = ar.length; i < len; i++) {
|
||||
r[i] = ar[i];
|
||||
}
|
||||
return r;
|
||||
}
|
||||
|
||||
function previous(n) {
|
||||
while (n = n.previousSibling) {
|
||||
if (n.nodeType == 1) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return n
|
||||
}
|
||||
|
||||
function q(query) {
|
||||
return query.match(chunker);
|
||||
}
|
||||
|
||||
// this next method expect at most these args
|
||||
// given => div.hello[title="world"]:foo('bar')
|
||||
|
||||
// div.hello[title="world"]:foo('bar'), div, .hello, [title="world"], title, =, world, :foo('bar'), foo, ('bar'), bar]
|
||||
|
||||
function interpret(whole, tag, idsAndClasses, wholeAttribute, attribute, qualifier, value, wholePseudo, pseudo, wholePseudoVal, pseudoVal) {
|
||||
var m, c, k;
|
||||
if (tag && this.tagName.toLowerCase() !== tag) {
|
||||
return false;
|
||||
}
|
||||
if (idsAndClasses && (m = idsAndClasses.match(id)) && m[1] !== this.id) {
|
||||
return false;
|
||||
}
|
||||
if (idsAndClasses && (classes = idsAndClasses.match(clas))) {
|
||||
for (i = classes.length; i--;) {
|
||||
c = classes[i].slice(1);
|
||||
if (!(classCache.g(c) || classCache.s(c, new RegExp('(^|\\s+)' + c + '(\\s+|$)'))).test(this.className)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pseudo && qwery.pseudos[pseudo] && !qwery.pseudos[pseudo](this, pseudoVal)) {
|
||||
return false;
|
||||
}
|
||||
if (wholeAttribute && !value) {
|
||||
o = this.attributes;
|
||||
for (k in o) {
|
||||
if (Object.prototype.hasOwnProperty.call(o, k) && (o[k].name || k) == attribute) {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (wholeAttribute && !checkAttr(qualifier, this.getAttribute(attribute) || '', value)) {
|
||||
return false;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
function clean(s) {
|
||||
return cleanCache.g(s) || cleanCache.s(s, s.replace(specialChars, '\\$1'));
|
||||
}
|
||||
|
||||
function checkAttr(qualify, actual, val) {
|
||||
switch (qualify) {
|
||||
case '=':
|
||||
return actual == val;
|
||||
case '^=':
|
||||
return actual.match(attrCache.g('^=' + val) || attrCache.s('^=' + val, new RegExp('^' + clean(val))));
|
||||
case '$=':
|
||||
return actual.match(attrCache.g('$=' + val) || attrCache.s('$=' + val, new RegExp(clean(val) + '$')));
|
||||
case '*=':
|
||||
return actual.match(attrCache.g(val) || attrCache.s(val, new RegExp(clean(val))));
|
||||
case '~=':
|
||||
return actual.match(attrCache.g('~=' + val) || attrCache.s('~=' + val, new RegExp('(?:^|\\s+)' + clean(val) + '(?:\\s+|$)')));
|
||||
case '|=':
|
||||
return actual.match(attrCache.g('|=' + val) || attrCache.s('|=' + val, new RegExp('^' + clean(val) + '(-|$)')));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
function _qwery(selector) {
|
||||
var r = [], ret = [], i, j = 0, k, l, m, p, token, tag, els, root, intr, item, children,
|
||||
tokens = tokenCache.g(selector) || tokenCache.s(selector, selector.split(tokenizr)),
|
||||
dividedTokens = selector.match(dividers), dividedToken;
|
||||
tokens = tokens.slice(0); // this makes a copy of the array so the cached original is not effected
|
||||
if (!tokens.length) {
|
||||
return r;
|
||||
}
|
||||
|
||||
token = tokens.pop();
|
||||
root = tokens.length && (m = tokens[tokens.length - 1].match(idOnly)) ? doc.getElementById(m[1]) : doc;
|
||||
if (!root) {
|
||||
return r;
|
||||
}
|
||||
intr = q(token);
|
||||
els = dividedTokens && /^[+~]$/.test(dividedTokens[dividedTokens.length - 1]) ? function (r) {
|
||||
while (root = root.nextSibling) {
|
||||
root.nodeType == 1 && (intr[1] ? intr[1] == root.tagName.toLowerCase() : 1) && r.push(root)
|
||||
}
|
||||
return r
|
||||
}([]) :
|
||||
root.getElementsByTagName(intr[1] || '*');
|
||||
for (i = 0, l = els.length; i < l; i++) {
|
||||
if (item = interpret.apply(els[i], intr)) {
|
||||
r[j++] = item;
|
||||
}
|
||||
}
|
||||
if (!tokens.length) {
|
||||
return r;
|
||||
}
|
||||
|
||||
// loop through all descendent tokens
|
||||
for (j = 0, l = r.length, k = 0; j < l; j++) {
|
||||
p = r[j];
|
||||
// loop through each token backwards crawling up tree
|
||||
for (i = tokens.length; i--;) {
|
||||
// loop through parent nodes
|
||||
while (p = walker[dividedTokens[i]](p, r[j])) {
|
||||
if (found = interpret.apply(p, q(tokens[i]))) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
found && (ret[k++] = r[j]);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
function boilerPlate(selector, _root, fn) {
|
||||
var root = (typeof _root == 'string') ? fn(_root)[0] : (_root || doc);
|
||||
if (selector === window || isNode(selector)) {
|
||||
return !_root || (selector !== window && isNode(root) && isAncestor(selector, root)) ? [selector] : [];
|
||||
}
|
||||
if (selector && typeof selector === 'object' && isFinite(selector.length)) {
|
||||
return array(selector);
|
||||
}
|
||||
if (m = selector.match(idOnly)) {
|
||||
return (el = doc.getElementById(m[1])) ? [el] : [];
|
||||
}
|
||||
if (m = selector.match(tagOnly)) {
|
||||
return array(root.getElementsByTagName(m[1]));
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function isNode(el) {
|
||||
return (el && el.nodeType && (el.nodeType == 1 || el.nodeType == 9));
|
||||
}
|
||||
|
||||
function uniq(ar) {
|
||||
var a = [], i, j;
|
||||
label:
|
||||
for (i = 0; i < ar.length; i++) {
|
||||
for (j = 0; j < a.length; j++) {
|
||||
if (a[j] == ar[i]) {
|
||||
continue label;
|
||||
}
|
||||
}
|
||||
a[a.length] = ar[i];
|
||||
}
|
||||
return a;
|
||||
}
|
||||
|
||||
function qwery(selector, _root) {
|
||||
var root = (typeof _root == 'string') ? qwery(_root)[0] : (_root || doc);
|
||||
if (!root || !selector) {
|
||||
return [];
|
||||
}
|
||||
if (m = boilerPlate(selector, _root, qwery)) {
|
||||
return m;
|
||||
}
|
||||
return select(selector, root);
|
||||
}
|
||||
|
||||
var isAncestor = 'compareDocumentPosition' in html ?
|
||||
function (element, container) {
|
||||
return (container.compareDocumentPosition(element) & 16) == 16;
|
||||
} : 'contains' in html ?
|
||||
function (element, container) {
|
||||
container = container == doc || container == window ? html : container;
|
||||
return container !== element && container.contains(element);
|
||||
} :
|
||||
function (element, container) {
|
||||
while (element = element.parentNode) {
|
||||
if (element === container) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
},
|
||||
|
||||
select = (doc.querySelector && doc.querySelectorAll) ?
|
||||
function (selector, root) {
|
||||
if (doc.getElementsByClassName && (m = selector.match(classOnly))) {
|
||||
return array((root).getElementsByClassName(m[1]));
|
||||
}
|
||||
return array((root).querySelectorAll(selector));
|
||||
} :
|
||||
function (selector, root) {
|
||||
selector = selector.replace(normalizr, '$1');
|
||||
var result = [], collection, collections = [], i;
|
||||
if (m = selector.match(tagAndOrClass)) {
|
||||
items = root.getElementsByTagName(m[1] || '*');
|
||||
r = classCache.g(m[2]) || classCache.s(m[2], new RegExp('(^|\\s+)' + m[2] + '(\\s+|$)'));
|
||||
for (i = 0, l = items.length, j = 0; i < l; i++) {
|
||||
r.test(items[i].className) && (result[j++] = items[i]);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
for (i = 0, items = selector.split(','), l = items.length; i < l; i++) {
|
||||
collections[i] = _qwery(items[i]);
|
||||
}
|
||||
for (i = 0, l = collections.length; i < l && (collection = collections[i]); i++) {
|
||||
var ret = collection;
|
||||
if (root !== doc) {
|
||||
ret = [];
|
||||
for (j = 0, m = collection.length; j < m && (element = collection[j]); j++) {
|
||||
// make sure element is a descendent of root
|
||||
isAncestor(element, root) && ret.push(element);
|
||||
}
|
||||
}
|
||||
result = result.concat(ret);
|
||||
}
|
||||
return uniq(result);
|
||||
};
|
||||
|
||||
qwery.uniq = uniq;
|
||||
qwery.pseudos = {};
|
||||
|
||||
var oldQwery = context.qwery;
|
||||
qwery.noConflict = function () {
|
||||
context.qwery = oldQwery;
|
||||
return this;
|
||||
};
|
||||
context['qwery'] = qwery;
|
||||
|
||||
}(this, document);
|
||||
|
||||
provide("qwery", module.exports);
|
||||
|
||||
!function (doc) {
|
||||
var q = qwery.noConflict();
|
||||
var table = 'table',
|
||||
nodeMap = {
|
||||
thead: table,
|
||||
tbody: table,
|
||||
tfoot: table,
|
||||
tr: 'tbody',
|
||||
th: 'tr',
|
||||
td: 'tr',
|
||||
fieldset: 'form',
|
||||
option: 'select'
|
||||
}
|
||||
function create(node, root) {
|
||||
var tag = /^<([^\s>]+)/.exec(node)[1]
|
||||
var el = (root || doc).createElement(nodeMap[tag] || 'div'), els = [];
|
||||
el.innerHTML = node;
|
||||
var nodes = el.childNodes;
|
||||
el = el.firstChild;
|
||||
els.push(el);
|
||||
while (el = el.nextSibling) {
|
||||
(el.nodeType == 1) && els.push(el);
|
||||
}
|
||||
return els;
|
||||
}
|
||||
$._select = function (s, r) {
|
||||
return /^\s*</.test(s) ? create(s, r) : q(s, r);
|
||||
};
|
||||
$.pseudos = q.pseudos;
|
||||
$.ender({
|
||||
find: function (s) {
|
||||
var r = [], i, l, j, k, els;
|
||||
for (i = 0, l = this.length; i < l; i++) {
|
||||
els = q(s, this[i]);
|
||||
for (j = 0, k = els.length; j < k; j++) {
|
||||
r.push(els[j]);
|
||||
}
|
||||
}
|
||||
return $(q.uniq(r));
|
||||
}
|
||||
, and: function (s) {
|
||||
var plus = $(s);
|
||||
for (var i = this.length, j = 0, l = this.length + plus.length; i < l; i++, j++) {
|
||||
this[i] = plus[j];
|
||||
}
|
||||
return this;
|
||||
}
|
||||
}, true);
|
||||
}(document);
|
||||
|
||||
}();
|
@ -1,8 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>hello, Node.js!</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1,8 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>hello, Node.js!</title>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1,2 +0,0 @@
|
||||
document.getElementById("test").innerHTML = "hello from javascript";
|
||||
window.doCheck();
|
@ -1,13 +0,0 @@
|
||||
<html>
|
||||
<head>
|
||||
<script>
|
||||
if(window.parent.aGlobal === 1) {
|
||||
window.parent.DONE = 1;
|
||||
}
|
||||
window.parent.PARENT_IS_TOP = parent === top;
|
||||
window.parent.LOADED_FRAME = 1;
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
</html>
|
@ -1 +0,0 @@
|
||||
document.getElementById("cat").innerHTML = "hello from nyan cat";
|
File diff suppressed because one or more lines are too long
1585
bower_components/jsdom/test/jsdom/index.js
vendored
1585
bower_components/jsdom/test/jsdom/index.js
vendored
File diff suppressed because it is too large
Load Diff
13
bower_components/jsdom/test/jsdom/leak.js
vendored
13
bower_components/jsdom/test/jsdom/leak.js
vendored
@ -1,13 +0,0 @@
|
||||
var jsdom = require('../../lib/jsdom');
|
||||
var path = require('path');
|
||||
|
||||
function again() {
|
||||
jsdom.env('<a class="testing">test</a>', [
|
||||
path.resolve(__dirname, '../jquery-fixtures/jquery-1.6.2.js'
|
||||
], function(errors, window) {
|
||||
window.close();
|
||||
setTimeout(again, 0);
|
||||
});
|
||||
}
|
||||
|
||||
again();
|
146
bower_components/jsdom/test/jsdom/parsing.js
vendored
146
bower_components/jsdom/test/jsdom/parsing.js
vendored
@ -1,146 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var jsdom = require("../..").jsdom;
|
||||
|
||||
// These tests are mostly random regression tests, not systematic parsing tests. They are compiled from the bug tracker.
|
||||
|
||||
exports["unclosed <td> (GH-605)"] = function (t) {
|
||||
var doc = jsdom("<table><tr><td>first td<td>second td</tr></table>");
|
||||
|
||||
var tds = doc.getElementsByTagName("td");
|
||||
|
||||
t.equal(tds.length, 2);
|
||||
t.equal(tds[0].innerHTML, 'first td');
|
||||
t.equal(tds[1].innerHTML, 'second td');
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["multiline attributes (GH-585)"] = function (t) {
|
||||
var doc = jsdom("<a data-title='<strong>hello \nworld</strong>' href='example.org</strong>'>link</a>");
|
||||
|
||||
var as = doc.getElementsByTagName("a");
|
||||
|
||||
t.equal(as.length, 1);
|
||||
t.equal(as[0].innerHTML, "link");
|
||||
t.equal(as[0].getAttribute("data-title"), "<strong>hello \nworld</strong>");
|
||||
t.equal(as[0].getAttribute("href"), "example.org</strong>");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["innerHTML of <script type='text/html'> (GH-575)"] = function (t) {
|
||||
var doc = jsdom("<script type='text/html'>script innerHTML</script>");
|
||||
|
||||
var scripts = doc.getElementsByTagName("script");
|
||||
|
||||
t.equal(scripts.length, 1);
|
||||
t.equal(scripts[0].innerHTML, "script innerHTML");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["attributes containing '<' and '>' (GH-494)"] = function (t) {
|
||||
var doc = jsdom("<p title='<'>stuff</p><p title='>'>more</p><p>just testing</p>");
|
||||
|
||||
var ps = doc.getElementsByTagName("p");
|
||||
|
||||
t.equal(ps.length, 3);
|
||||
t.equal(ps[0].getAttribute("title"), "<");
|
||||
t.equal(ps[1].getAttribute("title"), ">");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["empty attributes (GH-488)"] = function (t) {
|
||||
var doc = jsdom("<div ng-app></div>");
|
||||
|
||||
var divs = doc.getElementsByTagName("div");
|
||||
|
||||
t.equal(divs.length, 1);
|
||||
t.equal(divs[0].getAttribute("ng-app"), "");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["omitting optional closing tags (GH-482)"] = function (t) {
|
||||
var doc = jsdom("<p>First<p>Second<p>Third");
|
||||
|
||||
var ps = doc.getElementsByTagName("p");
|
||||
|
||||
t.equal(ps.length, 3);
|
||||
t.equal(ps[0].innerHTML, "First");
|
||||
t.equal(ps[1].innerHTML, "Second");
|
||||
t.equal(ps[2].innerHTML, "Third");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["crazy attribute names (GH-368)"] = function (t) {
|
||||
var doc = jsdom("<p <='' FAIL>stuff</p>");
|
||||
|
||||
var ps = doc.getElementsByTagName("p");
|
||||
|
||||
t.equal(ps.length, 1);
|
||||
t.equal(ps[0].innerHTML, "stuff");
|
||||
t.equal(ps[0].getAttribute("<"), "");
|
||||
t.equal(ps[0].getAttribute("fail"), "");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["attribute named 'constructor' (GH-625)"] = function (t) {
|
||||
var doc = jsdom("<element constructor='Hello'></element>");
|
||||
|
||||
var els = doc.getElementsByTagName("element");
|
||||
|
||||
t.equal(els.length, 1);
|
||||
t.equal(els[0].getAttribute("constructor"), "Hello");
|
||||
t.equal(els[0].attributes.length, 1);
|
||||
t.equal(els[0].outerHTML, "<element constructor=\"Hello\"></element>");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["CDATA should parse as bogus comments (GH-618)"] = function (t) {
|
||||
var doc = jsdom("<html><body><div><![CDATA[test]]></div></body></html>");
|
||||
|
||||
var div = doc.getElementsByTagName("div")[0];
|
||||
|
||||
t.ok(div);
|
||||
t.equal(div.childNodes.length, 1);
|
||||
|
||||
var comment = div.childNodes[0];
|
||||
t.equal(comment.nodeType, comment.COMMENT_NODE);
|
||||
t.equal(comment.nodeValue, "[CDATA[test]]");
|
||||
|
||||
t.equal(doc.documentElement.outerHTML, "<html><body><div><!--[CDATA[test]]--></div></body></html>");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["innerHTML behavior in <script> vs. <p> (GH-652)"] = function (t) {
|
||||
var doc = jsdom();
|
||||
|
||||
var script = doc.createElement("script");
|
||||
script.innerHTML = "3 < 5";
|
||||
t.equal(script.innerHTML, "3 < 5");
|
||||
|
||||
var p = doc.createElement("p");
|
||||
p.innerHTML = "3 < 5";
|
||||
t.equal(p.innerHTML, "3 < 5");
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["lower-cases tags in outerHTML and innerHTML"] = function (t) {
|
||||
var doc = jsdom("<HTML><BODY><P ALIGN='RIGHT'>test</P></BODY></HTML>");
|
||||
|
||||
t.equal(doc.documentElement.outerHTML, "<html><body><p align=\"RIGHT\">test</p></body></html>");
|
||||
|
||||
doc.body.innerHTML = "<DIV>test</DIV>";
|
||||
|
||||
t.equal(doc.body.innerHTML, "<div>test</div>");
|
||||
|
||||
t.done();
|
||||
};
|
221
bower_components/jsdom/test/jsdom/utils.js
vendored
221
bower_components/jsdom/test/jsdom/utils.js
vendored
@ -1,221 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var utils = require("../../lib/jsdom/utils");
|
||||
|
||||
exports["defineSetter defines a setter"] = function (t) {
|
||||
var o = {};
|
||||
var called = false;
|
||||
var expected = 'bar';
|
||||
var actual;
|
||||
|
||||
utils.defineSetter(o, 'foo', function (val) {
|
||||
called = true;
|
||||
actual = val;
|
||||
});
|
||||
|
||||
o.foo = expected;
|
||||
t.equal(called, true);
|
||||
t.equal(actual, expected);
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["defineSetter replaces existing setters"] = function (t) {
|
||||
var o = {};
|
||||
var originalCalled = false;
|
||||
var newCalled = false;
|
||||
|
||||
utils.defineSetter(o, 'foo', function (val) {
|
||||
originalCalled = true;
|
||||
});
|
||||
|
||||
utils.defineSetter(o, 'foo', function (val) {
|
||||
newCalled = true;
|
||||
});
|
||||
|
||||
o.foo = true;
|
||||
t.equal(originalCalled, false);
|
||||
t.equal(newCalled, true);
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["defineSetter does not remove existing getters"] = function (t) {
|
||||
var o = {};
|
||||
var called = false;
|
||||
var expected = 'bar';
|
||||
var actual;
|
||||
|
||||
utils.defineGetter(o, 'foo', function () {
|
||||
called = true;
|
||||
return expected;
|
||||
});
|
||||
|
||||
utils.defineSetter(o, 'foo', function (val) { /* NOP */ });
|
||||
|
||||
actual = o.foo;
|
||||
t.equal(called, true);
|
||||
t.equal(actual, expected);
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["defineGetter defines a getter"] = function (t) {
|
||||
var o = {};
|
||||
var called = false;
|
||||
var expected = 'bar';
|
||||
var actual;
|
||||
|
||||
utils.defineGetter(o, 'foo', function () {
|
||||
called = true;
|
||||
return expected
|
||||
});
|
||||
|
||||
actual = o.foo;
|
||||
t.equal(called, true);
|
||||
t.equal(actual, expected);
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["defineGetter replaces existing getters"] = function (t) {
|
||||
var o = {};
|
||||
var originalCalled = false;
|
||||
var newCalled = false;
|
||||
|
||||
utils.defineGetter(o, 'foo', function (val) {
|
||||
originalCalled = true;
|
||||
});
|
||||
|
||||
utils.defineGetter(o, 'foo', function (val) {
|
||||
newCalled = true;
|
||||
});
|
||||
|
||||
var actual = o.foo;
|
||||
t.equal(originalCalled, false);
|
||||
t.equal(newCalled, true);
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports["defineGetter does not remove existing setters"] = function (t) {
|
||||
var o = {};
|
||||
var called = false;
|
||||
var expected = 'bar';
|
||||
var actual;
|
||||
|
||||
utils.defineSetter(o, 'foo', function (val) {
|
||||
called = true;
|
||||
actual = val;
|
||||
});
|
||||
|
||||
utils.defineGetter(o, 'foo', function () { /* NOP */ });
|
||||
|
||||
o.foo = expected;
|
||||
t.equal(called, true);
|
||||
t.equal(actual, expected);
|
||||
|
||||
t.done();
|
||||
};
|
||||
|
||||
exports.createFrom = {
|
||||
"returns an object with the given [[Prototype]]": function (t) {
|
||||
var proto = {};
|
||||
|
||||
var o = utils.createFrom(proto);
|
||||
t.strictEqual(Object.getPrototypeOf(o), proto);
|
||||
|
||||
t.done();
|
||||
},
|
||||
"createFrom returns an object extended with the given properties":
|
||||
function (t) {
|
||||
var properties = {
|
||||
get accessor () {},
|
||||
set accessor (value) {},
|
||||
foo: 'bar'
|
||||
};
|
||||
|
||||
Object.defineProperties(properties, {
|
||||
frozen: {
|
||||
value: 'brrr',
|
||||
configurable: false,
|
||||
writable: false
|
||||
},
|
||||
hidden: {
|
||||
value: 'shhh',
|
||||
enumerable: false
|
||||
}
|
||||
});
|
||||
|
||||
var o = utils.createFrom({}, properties);
|
||||
|
||||
Object.getOwnPropertyNames(o).
|
||||
forEach(function (name) {
|
||||
t.deepEqual(Object.getOwnPropertyDescriptor(o, name),
|
||||
Object.getOwnPropertyDescriptor(properties, name),
|
||||
name + ' descriptors should be deeply equal'
|
||||
);
|
||||
});
|
||||
|
||||
t.done();
|
||||
}
|
||||
};
|
||||
|
||||
exports.inheritFrom = {
|
||||
"sets Subclass.prototype to an object w/ [[Prototype]] Superclass.prototype":
|
||||
function (t) {
|
||||
function Subclass(){}
|
||||
function Superclass(){}
|
||||
|
||||
utils.inheritFrom(Superclass, Subclass);
|
||||
|
||||
t.strictEqual(Object.getPrototypeOf(Subclass.prototype),
|
||||
Superclass.prototype);
|
||||
|
||||
t.done();
|
||||
},
|
||||
"sets Subclass.prototype.constructor to Subclass": function (t) {
|
||||
function Subclass(){}
|
||||
function Superclass(){}
|
||||
|
||||
utils.inheritFrom(Superclass, Subclass);
|
||||
|
||||
t.strictEqual(Subclass.prototype.constructor, Subclass);
|
||||
|
||||
t.done();
|
||||
},
|
||||
"extends Subclass.prototype with the given properties": function (t) {
|
||||
function Subclass(){}
|
||||
function Superclass(){}
|
||||
var properties = {
|
||||
get accessor () {},
|
||||
set accessor (value) {},
|
||||
foo: 'bar'
|
||||
};
|
||||
|
||||
Object.defineProperties(properties, {
|
||||
frozen: {
|
||||
value: 'brrr',
|
||||
configurable: false,
|
||||
writable: false
|
||||
},
|
||||
hidden: {
|
||||
value: 'shhh',
|
||||
enumerable: false
|
||||
}
|
||||
});
|
||||
|
||||
utils.inheritFrom(Superclass, Subclass, properties);
|
||||
|
||||
Object.getOwnPropertyNames(Subclass.prototype).
|
||||
forEach(function (name) {
|
||||
t.deepEqual(
|
||||
Object.getOwnPropertyDescriptor(Subclass.prototype, name),
|
||||
Object.getOwnPropertyDescriptor(properties, name),
|
||||
name + ' descriptors should be deeply equal'
|
||||
);
|
||||
});
|
||||
|
||||
t.done();
|
||||
}
|
||||
};
|
37
bower_components/jsdom/test/jsonp/jsonp.js
vendored
37
bower_components/jsdom/test/jsonp/jsonp.js
vendored
@ -1,37 +0,0 @@
|
||||
"use strict";
|
||||
|
||||
var jsdom = require("../../").jsdom;
|
||||
var url = require("url");
|
||||
var path = require("path");
|
||||
var http = require("http");
|
||||
var querystring = require("querystring");
|
||||
var jQueryFile = path.resolve(__dirname, "../jquery-fixtures/jquery-1.6.4.min.js");
|
||||
|
||||
exports["making a JSONP request from a jsdom window using jQuery"] = function (t) {
|
||||
var server = http.createServer(function (req, res) {
|
||||
res.writeHead(200);
|
||||
var u = url.parse(req.url, true);
|
||||
res.write(u.query.jsoncallback + "({\"message\":\"jsonp works!\"});");
|
||||
res.end();
|
||||
});
|
||||
|
||||
server.listen(43213, "127.0.0.1", function () {
|
||||
jsdom.env({
|
||||
html: "<!DOCTYPE html><html><head></head><body></body></html>",
|
||||
scripts: [jQueryFile],
|
||||
features: {
|
||||
FetchExternalResources: ["script"],
|
||||
ProcessExternalResources: ["script"]
|
||||
},
|
||||
done: function (errors, window) {
|
||||
t.ifError(errors);
|
||||
|
||||
window.jQuery.getJSON("http://localhost:43213?jsoncallback=?", function (data) {
|
||||
t.equal(data.message, "jsonp works!");
|
||||
server.close();
|
||||
t.done();
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
21885
bower_components/jsdom/test/level1/core.js
vendored
21885
bower_components/jsdom/test/level1/core.js
vendored
File diff suppressed because it is too large
Load Diff
@ -1,13 +0,0 @@
|
||||
var dom = require("../../../../lib/jsdom/level1/core").dom.level1.core;
|
||||
exports.extra = function() {
|
||||
|
||||
var doc = new dom.Document("staff");
|
||||
|
||||
var splitTextTest = doc.createElement("splitTextTest");
|
||||
splitTextTest.appendChild(doc.createTextNode("Split me"));
|
||||
splitTextTest.appendChild(doc.createElement("last"));
|
||||
doc.appendChild(splitTextTest);
|
||||
|
||||
doc.normalize();
|
||||
return doc;
|
||||
};
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user