jquery New Wave JavaScript

Similar documents
Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

Git. Presenter: Haotao (Eric) Lai Contact:

Siteforce Pilot: Best Practices

MEAN February. techdt.la

GIT Princípy tvorby softvéru, FMFI UK Jana Kostičová,

git commit --amend git rebase <base> git reflog git checkout -b Create and check out a new branch named <branch>. Drop the -b

Software Development I

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript

Tools. SWE 432, Fall Design and Implementation of Software for the Web

git Version: 2.0b Merge combines trees, and checks out the result Pull does a fetch, then a merge If you only can remember one command:

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

Using Git to Manage Source RTL

Git. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Tips on how to set up a GitHub account:

Human-Computer Interaction Design

Salvatore Rinzivillo VISUAL ANALYTICS

CS 520: VCS and Git. Intermediate Topics Ben Kushigian

projecto Documentation

Beyond git add/commit/push

Git Tutorial. André Sailer. ILD Technical Meeting April 24, 2017 CERN-EP-LCD. ILD Technical Meeting, Apr 24, 2017 A. Sailer: Git Tutorial 1/36

CS 390 Software Engineering Lecture 5 More Git

Brunch Documentation. Release Brunch team

Software Revision Control for MASS. Git Installation / Configuration / Use

Front End Nanodegree Syllabus

Git for Newbies. ComMouse Dongyue Studio

Web Development for Dinosaurs An Introduction to Modern Web Development

About SJTUG. SJTU *nix User Group SJTU Joyful Techie User Group

CSE 391 Lecture 9. Version control with Git

Improving Your Life With Git

Installing and Using Docker Toolbox for Mac OSX and Windows

Version Control System - Git. zswu

What is version control? (discuss) Who has used version control? Favorite VCS? Uses of version control (read)

jquery ajax get and F5A0010ECD0F3A43C7419B2CEF Jquery Ajax Get And 1 / 6

Git version control with Eclipse (EGit) Tutorial

User Interaction: jquery

Git & Github Fundamental by Rajesh Kumar.

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

MicroPython Basics: Load Files & Run Code

Building CircuitPython

FPLLL. Contributing. Martin R. Albrecht 2017/07/06

Versioning with git. Moritz August Git/Bash/Python-Course for MPE. Moritz August Versioning with Git

L25: Modern Compiler Design Exercises

Git Guide. Meher Krishna Patel. Created on : Octorber, 2017 Last updated : October, More documents are freely available at PythonDSP

KTH Royal Institute of Technology SEMINAR 2-29 March Simone Stefani -

Human-Computer Interaction Design

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Table of Contents. Concepts

LLVM Summer School, Paris 2017

TangeloHub Documentation

What is git? Distributed Version Control System (VCS); Created by Linus Torvalds, to help with Linux development;

Getting the files for the first time...2. Making Changes, Commiting them and Pull Requests:...5. Update your repository from the upstream master...

Git: Distributed Version Control

Chapter 5. Version Control: Git

Full Stack boot camp

Version Control: Gitting Started

Client Side JavaScript and AJAX

Creating a Patch. Created by Carl Heymann on 2010 Sep 14 1

USING GIT FOR AUTOMATION AND COLLABORATION JUSTIN ELLIOTT - MATT HANSEN PENN STATE UNIVERSITY

GETTING STARTED WITH. Michael Lessard Senior Solutions Architect June 2017

WorldSpace Attest Quick Start Guide

Managing Projects with Git

Composer and Drupal. CIDUG Meeting December 13, 2018 John Rearick

npm install [<name> [<name>...]] [--save --save-dev --save-optional]

AngularJS Fundamentals

Git: Distributed Version Control

Submitting your Work using GIT

G E T T I N G S TA R T E D W I T H G I T

2 Initialize a git repository on your machine, add a README file, commit and push

Composer Best Practices Nils Private Packagist

Algorithm Engineering

manifold Documentation

20480C: Programming in HTML5 with JavaScript and CSS3. Course Code: 20480C; Duration: 5 days; Instructor-led. JavaScript code.

Working in Teams CS 520 Theory and Practice of Software Engineering Fall 2018

How to version control like a pro: a roadmap to your reproducible & collaborative research

Grading Rubric Homework 1

CS 390 Software Engineering Lecture 4 - Git

USER GUIDE. MADCAP FLARE 2017 r3. Source Control: Git

Git Introduction CS 400. February 11, 2018

COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3

Comprehensive AngularJS Programming (5 Days)

Version control with git and Rstudio. Remko Duursma

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

The course is supplemented by numerous hands-on labs that help attendees reinforce their theoretical knowledge of the learned material.

Frontend UI Training. Whats App :

Git Resolve Conflict Using Mine Command Line

A BASIC UNDERSTANDING OF VERSION CONTROL

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

Git GitHub & secrets

Catbook Workshop: Intro to NodeJS. Monde Duinkharjav


Git, the magical version control

Full Stack Web Developer Nanodegree Syllabus

GIT FOR SYSTEM ADMINS JUSTIN ELLIOTT PENN STATE UNIVERSITY

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

New Contributor Tutorial and Best Practices

GitHub Classroom. Click Sign up in to top right of the page, and the following dialog is displayed.

Introduction to Automation. What is automation testing Advantages of Automation Testing How to learn any automation tool Types of Automation tools

Index. Elad Elrom 2016 E. Elrom, Pro MEAN Stack Development, DOI /

CESSDA Expert Seminar 13 & 14 September 2016 Prague, Czech Republic

Adafruit WebIDE. Created by Tyler Cooper. Last updated on :29:47 PM UTC

Transcription:

jquery New Wave JavaScript Contribution Guides In the spirit of open source software development, jquery always encourages community code contribution. To help you get started and before you jump into writing code, be sure to read these important contribution guidelines thoroughly: 1. Getting Involved (https://contribute.jquery.org/) 2. Core Style Guide (https://contribute.jquery.org/style-guide/js/) 3. Writing Code for jquery Foundation Projects (https://contribute.jquery.org/code/) Environments in which to use jquery Browser support (https://jquery.com/browser-support/) jquery also supports Node, browser extensions, and other non-browser environments. What you need to build your own jquery In order to build jquery, you need to have the latest Node.js/npm and git 1.7 or later. Earlier versions might work, but are not supported. For Windows, you have to download and install git (https://git-scm.com/downloads) and Node.js (https://nodejs.org/en/download/). OS X users should install Homebrew (http://brew.sh/). Once Homebrew is installed, run brew install git to install git, and brew install node to install Node.js. Linux/BSD users should use their appropriate package managers to install git and Node.js, or build from source if you swing that way. Easy-peasy. How to build your own jquery Clone a copy of the main jquery git repo by running: git clone git://github.com/jquery/jquery.git Enter the jquery directory and run the build script: cd jquery && npm run build 1 of 8

The built version of jquery will be put in the dist/ subdirectory, along with the minified copy and associated map file. If you want to create custom build or help with jquery development, it would be better to install grunt command line interface (https://github.com/gruntjs/grunt-cli) as a global package: npm install - g grunt- cli Make sure you have grunt installed by testing: grunt - V Now by running the grunt command, in the jquery directory, you can build a full version of jquery, just like with an npm run build command: grunt There are many other tasks available for jquery Core: grunt - help Modules Special builds can be created that exclude subsets of jquery functionality. This allows for smaller custom builds when the builder is certain that those parts of jquery are not being used. For example, an app that only used JSONP for $.ajax() and did not need to calculate offsets or positions of elements could exclude the offset and ajax/xhr modules. Any module may be excluded except for core, and selector. To exclude a module, pass its path relative to the src folder (without the.js extension). Some example modules that can be excluded are: ajax: All AJAX functionality: $.ajax(), $.get(), $.post(), $.ajaxsetup(),.load(), transports, and ajax event shorthands such as.ajaxstart(). ajax/xhr: The XMLHTTPRequest AJAX transport only. ajax/script: The <script> AJAX transport only; used to retrieve scripts. ajax/jsonp: The JSONP AJAX transport only; depends on the ajax/script transport. css: The.css() method. Also removes all modules depending on css (including effects, dimensions, and offset). css/showhide: Non-animated.show(),.hide() and.toggle(); can be excluded if you use classes or explicit.css() calls to set the display property. Also removes the effects module. deprecated: Methods documented as deprecated but not yet removed. dimensions: The.width() and.height() methods, including inner- and outervariations. 2 of 8

effects: The.animate() method and its shorthands such as.slideup() or.hide("slow"). event: The.on() and.off() methods and all event functionality. Also removes event/alias. event/alias: All event attaching/triggering shorthands like.click() or.mouseover(). event/focusin: Cross-browser support for the focusin and focusout events. event/trigger: The.trigger() and.triggerhandler() methods. Used by alias and focusin modules. offset: The.offset(),.position(),.offsetParent(),.scrollLeft(), and.scrolltop() methods. wrap: The.wrap(),.wrapAll(),.wrapInner(), and.unwrap() methods. core/ready: Exclude the ready module if you place your scripts at the end of the body. Any ready callbacks bound with jquery() will simply be called immediately. However, jquery(document).ready() will not be a function and.on("ready",...) or similar will not be triggered. deferred: Exclude jquery.deferred. This also removes jquery.callbacks. Note that modules that depend on jquery.deferred(ajax, effects, core/ready) will not be removed and will still expect jquery.deferred to be there. Include your own jquery.deferred implementation or exclude those modules as well (grunt custom:-deferred,-ajax,- effects,-core/ready). exports/global: Exclude the attachment of global jquery variables ($ and jquery) to the window. exports/amd: Exclude the AMD definition. As a special case, you may also replace Sizzle by using a special flag grunt custom:-sizzle. sizzle: The Sizzle selector engine. When this module is excluded, it is replaced by a rudimentary selector engine based on the browser's queryselectorall method that does not support jquery selector extensions or enhanced semantics. See the selectornative.js (https://github.com/jquery/jquery/blob/master/src/selector-native.js) file for details. Note: Excluding Sizzle will also exclude all jquery selector extensions (such as effects/animatedselector and css/hiddenvisibleselectors). The build process shows a message for each dependent module it excludes or includes. AMD name As an option, you can set the module name for jquery's AMD definition. By default, it is set to "jquery", which plays nicely with plugins and third-party libraries, but there may be cases where you'd like to change this. Simply set the "amd" option: grunt custom --amd= "custom-name" Or, to define anonymously, set the name to an empty string. grunt custom --amd= "" 3 of 8

Custom Build Examples To create a custom build, first check out the version: git pull; git checkout VERSION Where VERSION is the version you want to customize. Then, make sure all Node dependencies are installed: npm install Create the custom build using the grunt custom option, listing the modules to be excluded. Exclude all ajax functionality: grunt custom:-ajax Excluding css removes modules depending on CSS: effects, offset, dimensions. grunt custom:-css Exclude a bunch of modules: grunt custom:-ajax,-css,-deprecated,-dimensions,-effects,-event/alias,-offset,-wrap For questions or requests regarding custom builds, please start a thread on the Developing jquery Core (https://forum.jquery.com/developing-jquery-core) section of the forum. Due to the combinatorics and custom nature of these builds, they are not regularly tested in jquery's unit test process. The non-sizzle selector engine currently does not pass unit tests because it is missing too much essential functionality. Running the Unit Tests Make sure you have the necessary dependencies: npm install Start grunt watch or npm start to auto-build jquery as you work: grunt watch Run the unit tests with a local server that supports PHP. Ensure that you run the site from the root directory, not the "test" directory. No database is required. Pre-configured php local servers are available for Windows and Mac. Here are some options: Windows: WAMP download (http://www.wampserver.com/en/) Mac: MAMP download (https://www.mamp.info/en/downloads/) 4 of 8

Linux: Setting up LAMP (https://www.linux.com/learn/tutorials/288158-easy-lamp-server-installation) Mongoose (most platforms) (https://code.google.com/p/mongoose/) Building to a different directory To copy the built jquery files from /dist to another directory: grunt && grunt dist:/path/to/special/location/ With this example, the output files would be: /path/to/special/location/jquery.js /path/to/special/location/jquery.min.js To add a permanent copy destination, create a file in dist/ called ".destination.json". Inside the file, paste and customize the following: { } "/Absolute/path/to/other/destination": truet r u e Additionally, both methods can be combined. Essential Git As the source code is handled by the Git version control system, it's useful to know some features used. Cleaning If you want to purge your working directory back to the status of upstream, the following commands can be used (remember everything you've worked on is gone after these): git reset --hard upstream/master git clean -fdx Rebasing For feature/topic branches, you should always use the --rebase flag to git pull, or if you are usually handling many temporary "to be in a github pull request" branches, run the following to automate this: git config branch.autosetuprebase local (see man git-config for more information) 5 of 8

Handling merge conflicts If you're getting merge conflicts when merging, instead of editing the conflicted files manually, you can use the feature git mergetool. Even though the default tool xxdiff looks awful/old, it's rather useful. The following are some commands that can be used there: Ctrl + Alt + M - automerge as much as possible b - jump to next merge conflict s - change the order of the conflicted lines u - undo a merge left mouse button - mark a block to be the winner middle mouse button - mark a line to be the winner Ctrl + S - save Ctrl + Q - quit QUnit Reference Test methods expect( numassertions ); stop(); start(); Note: QUnit's eventual addition of an argument to stop/start is ignored in this test suite so that start and stop can be passed as callbacks without worrying about their parameters. Test assertions ok( value, [message] ); equal( actual, expected, [message] ); notequal( actual, expected, [message] ); deepequal( actual, expected, [message] ); notdeepequal( actual, expected, [message] ); strictequal( actual, expected, [message] ); notstrictequal( actual, expected, [message] ); throws ( block, [expected], [message] ); Test Suite Convenience Methods Reference (See test/data/testinit.js) Returns an array of elements with the given IDs 6 of 8

q(... ); Example: q("main", "foo", "bar"); = => > [ div#main, span#foo, input#bar ] Asserts that a selection matches the given IDs t( testname, selector, [ "array", "of", "ids" ] ); Example: t("check for something", "//[a]", ["foo", "bar"]); Fires a native DOM event without going through jquery firenative( node, eventtype ) Example: firenative( jquery("#elem")[0], "click" ); Add random number to url to stop caching url( "some/url" ); Example: url("index.html"); = => > "data/index.html?10538358428943" url("mock.php?foo=bar"); = => > "data/mock.php?foo=bar&10538358345554" Run tests in an iframe Some tests may require a document other than the standard test fixture, and these can be run in a separate iframe. The actual test code and assertions remain in jquery's main test files; only the minimal test fixture markup and setup code should be placed in the iframe file. testiframe( testname, filename, 7 of 8

function testcallback( assert, jquery, window, document, [ additional args ] ) {... } ); This loads a page, constructing a url with filename "./data/" + filename. The iframed page determines when the callback occurs in the test by including the "/test/data/iframetest.js" script and calling startiframetest( [ additional args ] ) when appropriate. Often this will be after either document ready or window.onload fires. The testcallback receives the QUnit assert object created by testiframe for this test, followed by the global jquery, window, and document from the iframe. If the iframe code passes any arguments to startiframetest, they follow the document argument. Questions? If you have any questions, please feel free to ask on the Developing jquery Core forum (https://forum.jquery.com/developing-jquery-core) or in #jquery on irc.freenode.net. 8 of 8