govuk_publishing_components 18.1.1 → 18.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (112) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/govuk_publishing_components/components/_share-links.scss +11 -5
  3. data/app/views/govuk_publishing_components/components/docs/share_links.yml +10 -7
  4. data/lib/govuk_publishing_components/version.rb +1 -1
  5. data/node_modules/jquery/AUTHORS.txt +266 -0
  6. data/node_modules/jquery/LICENSE.txt +36 -0
  7. data/node_modules/jquery/README.md +65 -0
  8. data/node_modules/jquery/bower.json +14 -0
  9. data/node_modules/jquery/dist/jquery.js +11008 -0
  10. data/node_modules/jquery/dist/jquery.min.js +5 -0
  11. data/node_modules/jquery/dist/jquery.min.map +1 -0
  12. data/node_modules/jquery/external/sizzle/LICENSE.txt +36 -0
  13. data/node_modules/jquery/external/sizzle/dist/sizzle.js +2143 -0
  14. data/node_modules/jquery/external/sizzle/dist/sizzle.min.js +3 -0
  15. data/node_modules/jquery/external/sizzle/dist/sizzle.min.map +1 -0
  16. data/node_modules/jquery/package.json +157 -0
  17. data/node_modules/jquery/src/ajax.js +842 -0
  18. data/node_modules/jquery/src/ajax/jsonp.js +100 -0
  19. data/node_modules/jquery/src/ajax/load.js +83 -0
  20. data/node_modules/jquery/src/ajax/parseJSON.js +53 -0
  21. data/node_modules/jquery/src/ajax/parseXML.js +31 -0
  22. data/node_modules/jquery/src/ajax/script.js +95 -0
  23. data/node_modules/jquery/src/ajax/var/location.js +3 -0
  24. data/node_modules/jquery/src/ajax/var/nonce.js +5 -0
  25. data/node_modules/jquery/src/ajax/var/rquery.js +3 -0
  26. data/node_modules/jquery/src/ajax/xhr.js +229 -0
  27. data/node_modules/jquery/src/attributes.js +11 -0
  28. data/node_modules/jquery/src/attributes/attr.js +281 -0
  29. data/node_modules/jquery/src/attributes/classes.js +174 -0
  30. data/node_modules/jquery/src/attributes/prop.js +156 -0
  31. data/node_modules/jquery/src/attributes/support.js +70 -0
  32. data/node_modules/jquery/src/attributes/val.js +191 -0
  33. data/node_modules/jquery/src/callbacks.js +232 -0
  34. data/node_modules/jquery/src/core.js +529 -0
  35. data/node_modules/jquery/src/core/access.js +65 -0
  36. data/node_modules/jquery/src/core/init.js +140 -0
  37. data/node_modules/jquery/src/core/parseHTML.js +41 -0
  38. data/node_modules/jquery/src/core/ready.js +163 -0
  39. data/node_modules/jquery/src/core/var/rsingleTag.js +5 -0
  40. data/node_modules/jquery/src/css.js +563 -0
  41. data/node_modules/jquery/src/css/addGetHookIf.js +24 -0
  42. data/node_modules/jquery/src/css/adjustCSS.js +65 -0
  43. data/node_modules/jquery/src/css/curCSS.js +137 -0
  44. data/node_modules/jquery/src/css/defaultDisplay.js +72 -0
  45. data/node_modules/jquery/src/css/hiddenVisibleSelectors.js +42 -0
  46. data/node_modules/jquery/src/css/showHide.js +45 -0
  47. data/node_modules/jquery/src/css/support.js +184 -0
  48. data/node_modules/jquery/src/css/var/cssExpand.js +3 -0
  49. data/node_modules/jquery/src/css/var/isHidden.js +16 -0
  50. data/node_modules/jquery/src/css/var/rmargin.js +3 -0
  51. data/node_modules/jquery/src/css/var/rnumnonpx.js +5 -0
  52. data/node_modules/jquery/src/css/var/swap.js +24 -0
  53. data/node_modules/jquery/src/data.js +342 -0
  54. data/node_modules/jquery/src/data/support.js +23 -0
  55. data/node_modules/jquery/src/data/var/acceptData.js +20 -0
  56. data/node_modules/jquery/src/deferred.js +159 -0
  57. data/node_modules/jquery/src/deprecated.js +34 -0
  58. data/node_modules/jquery/src/dimensions.js +56 -0
  59. data/node_modules/jquery/src/effects.js +640 -0
  60. data/node_modules/jquery/src/effects/Tween.js +121 -0
  61. data/node_modules/jquery/src/effects/animatedSelector.js +13 -0
  62. data/node_modules/jquery/src/effects/support.js +58 -0
  63. data/node_modules/jquery/src/event.js +1134 -0
  64. data/node_modules/jquery/src/event/ajax.js +20 -0
  65. data/node_modules/jquery/src/event/alias.js +25 -0
  66. data/node_modules/jquery/src/event/support.js +28 -0
  67. data/node_modules/jquery/src/exports/amd.js +24 -0
  68. data/node_modules/jquery/src/exports/global.js +26 -0
  69. data/node_modules/jquery/src/intro.js +44 -0
  70. data/node_modules/jquery/src/jquery.js +37 -0
  71. data/node_modules/jquery/src/manipulation.js +585 -0
  72. data/node_modules/jquery/src/manipulation/_evalUrl.js +21 -0
  73. data/node_modules/jquery/src/manipulation/buildFragment.js +157 -0
  74. data/node_modules/jquery/src/manipulation/createSafeFragment.js +20 -0
  75. data/node_modules/jquery/src/manipulation/getAll.js +33 -0
  76. data/node_modules/jquery/src/manipulation/setGlobalEval.js +19 -0
  77. data/node_modules/jquery/src/manipulation/support.js +72 -0
  78. data/node_modules/jquery/src/manipulation/var/nodeNames.js +5 -0
  79. data/node_modules/jquery/src/manipulation/var/rcheckableType.js +3 -0
  80. data/node_modules/jquery/src/manipulation/var/rleadingWhitespace.js +3 -0
  81. data/node_modules/jquery/src/manipulation/var/rscriptType.js +3 -0
  82. data/node_modules/jquery/src/manipulation/var/rtagName.js +3 -0
  83. data/node_modules/jquery/src/manipulation/wrapMap.js +30 -0
  84. data/node_modules/jquery/src/offset.js +219 -0
  85. data/node_modules/jquery/src/outro.js +2 -0
  86. data/node_modules/jquery/src/queue.js +144 -0
  87. data/node_modules/jquery/src/queue/delay.js +22 -0
  88. data/node_modules/jquery/src/selector-sizzle.js +14 -0
  89. data/node_modules/jquery/src/selector.js +1 -0
  90. data/node_modules/jquery/src/serialize.js +125 -0
  91. data/node_modules/jquery/src/support.js +63 -0
  92. data/node_modules/jquery/src/traversing.js +179 -0
  93. data/node_modules/jquery/src/traversing/findFilter.js +100 -0
  94. data/node_modules/jquery/src/traversing/var/dir.js +20 -0
  95. data/node_modules/jquery/src/traversing/var/rneedsContext.js +6 -0
  96. data/node_modules/jquery/src/traversing/var/siblings.js +15 -0
  97. data/node_modules/jquery/src/var/class2type.js +5 -0
  98. data/node_modules/jquery/src/var/concat.js +5 -0
  99. data/node_modules/jquery/src/var/deletedIds.js +3 -0
  100. data/node_modules/jquery/src/var/document.js +3 -0
  101. data/node_modules/jquery/src/var/documentElement.js +5 -0
  102. data/node_modules/jquery/src/var/hasOwn.js +5 -0
  103. data/node_modules/jquery/src/var/indexOf.js +5 -0
  104. data/node_modules/jquery/src/var/pnum.js +3 -0
  105. data/node_modules/jquery/src/var/push.js +5 -0
  106. data/node_modules/jquery/src/var/rcssNum.js +7 -0
  107. data/node_modules/jquery/src/var/rnotwhite.js +3 -0
  108. data/node_modules/jquery/src/var/slice.js +5 -0
  109. data/node_modules/jquery/src/var/support.js +5 -0
  110. data/node_modules/jquery/src/var/toString.js +5 -0
  111. data/node_modules/jquery/src/wrap.js +77 -0
  112. metadata +109 -2
@@ -0,0 +1,21 @@
1
+ define( [
2
+ "../ajax"
3
+ ], function( jQuery ) {
4
+
5
+ jQuery._evalUrl = function( url ) {
6
+ return jQuery.ajax( {
7
+ url: url,
8
+
9
+ // Make this explicit, since user can override this through ajaxSetup (#11264)
10
+ type: "GET",
11
+ dataType: "script",
12
+ cache: true,
13
+ async: false,
14
+ global: false,
15
+ "throws": true
16
+ } );
17
+ };
18
+
19
+ return jQuery._evalUrl;
20
+
21
+ } );
@@ -0,0 +1,157 @@
1
+ define( [
2
+ "../core",
3
+ "./var/rcheckableType",
4
+ "./var/rtagName",
5
+ "./var/rscriptType",
6
+ "./var/rleadingWhitespace",
7
+ "./createSafeFragment",
8
+ "./wrapMap",
9
+ "./getAll",
10
+ "./setGlobalEval",
11
+ "./support"
12
+ ], function( jQuery, rcheckableType, rtagName, rscriptType, rleadingWhitespace,
13
+ createSafeFragment, wrapMap, getAll, setGlobalEval, support ) {
14
+
15
+ var rhtml = /<|&#?\w+;/,
16
+ rtbody = /<tbody/i;
17
+
18
+ function fixDefaultChecked( elem ) {
19
+ if ( rcheckableType.test( elem.type ) ) {
20
+ elem.defaultChecked = elem.checked;
21
+ }
22
+ }
23
+
24
+ function buildFragment( elems, context, scripts, selection, ignored ) {
25
+ var j, elem, contains,
26
+ tmp, tag, tbody, wrap,
27
+ l = elems.length,
28
+
29
+ // Ensure a safe fragment
30
+ safe = createSafeFragment( context ),
31
+
32
+ nodes = [],
33
+ i = 0;
34
+
35
+ for ( ; i < l; i++ ) {
36
+ elem = elems[ i ];
37
+
38
+ if ( elem || elem === 0 ) {
39
+
40
+ // Add nodes directly
41
+ if ( jQuery.type( elem ) === "object" ) {
42
+ jQuery.merge( nodes, elem.nodeType ? [ elem ] : elem );
43
+
44
+ // Convert non-html into a text node
45
+ } else if ( !rhtml.test( elem ) ) {
46
+ nodes.push( context.createTextNode( elem ) );
47
+
48
+ // Convert html into DOM nodes
49
+ } else {
50
+ tmp = tmp || safe.appendChild( context.createElement( "div" ) );
51
+
52
+ // Deserialize a standard representation
53
+ tag = ( rtagName.exec( elem ) || [ "", "" ] )[ 1 ].toLowerCase();
54
+ wrap = wrapMap[ tag ] || wrapMap._default;
55
+
56
+ tmp.innerHTML = wrap[ 1 ] + jQuery.htmlPrefilter( elem ) + wrap[ 2 ];
57
+
58
+ // Descend through wrappers to the right content
59
+ j = wrap[ 0 ];
60
+ while ( j-- ) {
61
+ tmp = tmp.lastChild;
62
+ }
63
+
64
+ // Manually add leading whitespace removed by IE
65
+ if ( !support.leadingWhitespace && rleadingWhitespace.test( elem ) ) {
66
+ nodes.push( context.createTextNode( rleadingWhitespace.exec( elem )[ 0 ] ) );
67
+ }
68
+
69
+ // Remove IE's autoinserted <tbody> from table fragments
70
+ if ( !support.tbody ) {
71
+
72
+ // String was a <table>, *may* have spurious <tbody>
73
+ elem = tag === "table" && !rtbody.test( elem ) ?
74
+ tmp.firstChild :
75
+
76
+ // String was a bare <thead> or <tfoot>
77
+ wrap[ 1 ] === "<table>" && !rtbody.test( elem ) ?
78
+ tmp :
79
+ 0;
80
+
81
+ j = elem && elem.childNodes.length;
82
+ while ( j-- ) {
83
+ if ( jQuery.nodeName( ( tbody = elem.childNodes[ j ] ), "tbody" ) &&
84
+ !tbody.childNodes.length ) {
85
+
86
+ elem.removeChild( tbody );
87
+ }
88
+ }
89
+ }
90
+
91
+ jQuery.merge( nodes, tmp.childNodes );
92
+
93
+ // Fix #12392 for WebKit and IE > 9
94
+ tmp.textContent = "";
95
+
96
+ // Fix #12392 for oldIE
97
+ while ( tmp.firstChild ) {
98
+ tmp.removeChild( tmp.firstChild );
99
+ }
100
+
101
+ // Remember the top-level container for proper cleanup
102
+ tmp = safe.lastChild;
103
+ }
104
+ }
105
+ }
106
+
107
+ // Fix #11356: Clear elements from fragment
108
+ if ( tmp ) {
109
+ safe.removeChild( tmp );
110
+ }
111
+
112
+ // Reset defaultChecked for any radios and checkboxes
113
+ // about to be appended to the DOM in IE 6/7 (#8060)
114
+ if ( !support.appendChecked ) {
115
+ jQuery.grep( getAll( nodes, "input" ), fixDefaultChecked );
116
+ }
117
+
118
+ i = 0;
119
+ while ( ( elem = nodes[ i++ ] ) ) {
120
+
121
+ // Skip elements already in the context collection (trac-4087)
122
+ if ( selection && jQuery.inArray( elem, selection ) > -1 ) {
123
+ if ( ignored ) {
124
+ ignored.push( elem );
125
+ }
126
+
127
+ continue;
128
+ }
129
+
130
+ contains = jQuery.contains( elem.ownerDocument, elem );
131
+
132
+ // Append to fragment
133
+ tmp = getAll( safe.appendChild( elem ), "script" );
134
+
135
+ // Preserve script evaluation history
136
+ if ( contains ) {
137
+ setGlobalEval( tmp );
138
+ }
139
+
140
+ // Capture executables
141
+ if ( scripts ) {
142
+ j = 0;
143
+ while ( ( elem = tmp[ j++ ] ) ) {
144
+ if ( rscriptType.test( elem.type || "" ) ) {
145
+ scripts.push( elem );
146
+ }
147
+ }
148
+ }
149
+ }
150
+
151
+ tmp = null;
152
+
153
+ return safe;
154
+ }
155
+
156
+ return buildFragment;
157
+ } );
@@ -0,0 +1,20 @@
1
+ define( [
2
+ "./var/nodeNames"
3
+ ], function( nodeNames ) {
4
+
5
+ function createSafeFragment( document ) {
6
+ var list = nodeNames.split( "|" ),
7
+ safeFrag = document.createDocumentFragment();
8
+
9
+ if ( safeFrag.createElement ) {
10
+ while ( list.length ) {
11
+ safeFrag.createElement(
12
+ list.pop()
13
+ );
14
+ }
15
+ }
16
+ return safeFrag;
17
+ }
18
+
19
+ return createSafeFragment;
20
+ } );
@@ -0,0 +1,33 @@
1
+ define( [
2
+ "../core"
3
+ ], function( jQuery ) {
4
+
5
+ function getAll( context, tag ) {
6
+ var elems, elem,
7
+ i = 0,
8
+ found = typeof context.getElementsByTagName !== "undefined" ?
9
+ context.getElementsByTagName( tag || "*" ) :
10
+ typeof context.querySelectorAll !== "undefined" ?
11
+ context.querySelectorAll( tag || "*" ) :
12
+ undefined;
13
+
14
+ if ( !found ) {
15
+ for ( found = [], elems = context.childNodes || context;
16
+ ( elem = elems[ i ] ) != null;
17
+ i++
18
+ ) {
19
+ if ( !tag || jQuery.nodeName( elem, tag ) ) {
20
+ found.push( elem );
21
+ } else {
22
+ jQuery.merge( found, getAll( elem, tag ) );
23
+ }
24
+ }
25
+ }
26
+
27
+ return tag === undefined || tag && jQuery.nodeName( context, tag ) ?
28
+ jQuery.merge( [ context ], found ) :
29
+ found;
30
+ }
31
+
32
+ return getAll;
33
+ } );
@@ -0,0 +1,19 @@
1
+ define( [
2
+ "../core"
3
+ ], function( jQuery ) {
4
+
5
+ // Mark scripts as having already been evaluated
6
+ function setGlobalEval( elems, refElements ) {
7
+ var elem,
8
+ i = 0;
9
+ for ( ; ( elem = elems[ i ] ) != null; i++ ) {
10
+ jQuery._data(
11
+ elem,
12
+ "globalEval",
13
+ !refElements || jQuery._data( refElements[ i ], "globalEval" )
14
+ );
15
+ }
16
+ }
17
+
18
+ return setGlobalEval;
19
+ } );
@@ -0,0 +1,72 @@
1
+ define( [
2
+ "../core",
3
+ "../var/document",
4
+ "../var/support"
5
+ ], function( jQuery, document, support ) {
6
+
7
+ ( function() {
8
+ var div = document.createElement( "div" ),
9
+ fragment = document.createDocumentFragment(),
10
+ input = document.createElement( "input" );
11
+
12
+ // Setup
13
+ div.innerHTML = " <link/><table></table><a href='/a'>a</a><input type='checkbox'/>";
14
+
15
+ // IE strips leading whitespace when .innerHTML is used
16
+ support.leadingWhitespace = div.firstChild.nodeType === 3;
17
+
18
+ // Make sure that tbody elements aren't automatically inserted
19
+ // IE will insert them into empty tables
20
+ support.tbody = !div.getElementsByTagName( "tbody" ).length;
21
+
22
+ // Make sure that link elements get serialized correctly by innerHTML
23
+ // This requires a wrapper element in IE
24
+ support.htmlSerialize = !!div.getElementsByTagName( "link" ).length;
25
+
26
+ // Makes sure cloning an html5 element does not cause problems
27
+ // Where outerHTML is undefined, this still works
28
+ support.html5Clone =
29
+ document.createElement( "nav" ).cloneNode( true ).outerHTML !== "<:nav></:nav>";
30
+
31
+ // Check if a disconnected checkbox will retain its checked
32
+ // value of true after appended to the DOM (IE6/7)
33
+ input.type = "checkbox";
34
+ input.checked = true;
35
+ fragment.appendChild( input );
36
+ support.appendChecked = input.checked;
37
+
38
+ // Make sure textarea (and checkbox) defaultValue is properly cloned
39
+ // Support: IE6-IE11+
40
+ div.innerHTML = "<textarea>x</textarea>";
41
+ support.noCloneChecked = !!div.cloneNode( true ).lastChild.defaultValue;
42
+
43
+ // #11217 - WebKit loses check when the name is after the checked attribute
44
+ fragment.appendChild( div );
45
+
46
+ // Support: Windows Web Apps (WWA)
47
+ // `name` and `type` must use .setAttribute for WWA (#14901)
48
+ input = document.createElement( "input" );
49
+ input.setAttribute( "type", "radio" );
50
+ input.setAttribute( "checked", "checked" );
51
+ input.setAttribute( "name", "t" );
52
+
53
+ div.appendChild( input );
54
+
55
+ // Support: Safari 5.1, iOS 5.1, Android 4.x, Android 2.3
56
+ // old WebKit doesn't clone checked state correctly in fragments
57
+ support.checkClone = div.cloneNode( true ).cloneNode( true ).lastChild.checked;
58
+
59
+ // Support: IE<9
60
+ // Cloned elements keep attachEvent handlers, we use addEventListener on IE9+
61
+ support.noCloneEvent = !!div.addEventListener;
62
+
63
+ // Support: IE<9
64
+ // Since attributes and properties are the same in IE,
65
+ // cleanData must set properties to undefined rather than use removeAttribute
66
+ div[ jQuery.expando ] = 1;
67
+ support.attributes = !div.getAttribute( jQuery.expando );
68
+ } )();
69
+
70
+ return support;
71
+
72
+ } );
@@ -0,0 +1,5 @@
1
+ define( function() {
2
+ return "abbr|article|aside|audio|bdi|canvas|data|datalist|" +
3
+ "details|dialog|figcaption|figure|footer|header|hgroup|main|" +
4
+ "mark|meter|nav|output|picture|progress|section|summary|template|time|video";
5
+ } );
@@ -0,0 +1,3 @@
1
+ define( function() {
2
+ return ( /^(?:checkbox|radio)$/i );
3
+ } );
@@ -0,0 +1,3 @@
1
+ define( function() {
2
+ return ( /^\s+/ );
3
+ } );
@@ -0,0 +1,3 @@
1
+ define( function() {
2
+ return ( /^$|\/(?:java|ecma)script/i );
3
+ } );
@@ -0,0 +1,3 @@
1
+ define( function() {
2
+ return ( /<([\w:-]+)/ );
3
+ } );
@@ -0,0 +1,30 @@
1
+ define( [
2
+ "./support"
3
+ ], function( support ) {
4
+
5
+ // We have to close these tags to support XHTML (#13200)
6
+ var wrapMap = {
7
+ option: [ 1, "<select multiple='multiple'>", "</select>" ],
8
+ legend: [ 1, "<fieldset>", "</fieldset>" ],
9
+ area: [ 1, "<map>", "</map>" ],
10
+
11
+ // Support: IE8
12
+ param: [ 1, "<object>", "</object>" ],
13
+ thead: [ 1, "<table>", "</table>" ],
14
+ tr: [ 2, "<table><tbody>", "</tbody></table>" ],
15
+ col: [ 2, "<table><tbody></tbody><colgroup>", "</colgroup></table>" ],
16
+ td: [ 3, "<table><tbody><tr>", "</tr></tbody></table>" ],
17
+
18
+ // IE6-8 can't serialize link, script, style, or any html5 (NoScope) tags,
19
+ // unless wrapped in a div with non-breaking characters in front of it.
20
+ _default: support.htmlSerialize ? [ 0, "", "" ] : [ 1, "X<div>", "</div>" ]
21
+ };
22
+
23
+ // Support: IE8-IE9
24
+ wrapMap.optgroup = wrapMap.option;
25
+
26
+ wrapMap.tbody = wrapMap.tfoot = wrapMap.colgroup = wrapMap.caption = wrapMap.thead;
27
+ wrapMap.th = wrapMap.td;
28
+
29
+ return wrapMap;
30
+ } );
@@ -0,0 +1,219 @@
1
+ define( [
2
+ "./core",
3
+ "./core/access",
4
+ "./var/document",
5
+ "./var/documentElement",
6
+ "./css/var/rnumnonpx",
7
+ "./css/curCSS",
8
+ "./css/addGetHookIf",
9
+ "./css/support",
10
+
11
+ "./core/init",
12
+ "./css",
13
+ "./selector" // contains
14
+ ], function( jQuery, access, document, documentElement, rnumnonpx, curCSS, addGetHookIf, support ) {
15
+
16
+ // BuildExclude
17
+ curCSS = curCSS.curCSS;
18
+
19
+ /**
20
+ * Gets a window from an element
21
+ */
22
+ function getWindow( elem ) {
23
+ return jQuery.isWindow( elem ) ?
24
+ elem :
25
+ elem.nodeType === 9 ?
26
+ elem.defaultView || elem.parentWindow :
27
+ false;
28
+ }
29
+
30
+ jQuery.offset = {
31
+ setOffset: function( elem, options, i ) {
32
+ var curPosition, curLeft, curCSSTop, curTop, curOffset, curCSSLeft, calculatePosition,
33
+ position = jQuery.css( elem, "position" ),
34
+ curElem = jQuery( elem ),
35
+ props = {};
36
+
37
+ // set position first, in-case top/left are set even on static elem
38
+ if ( position === "static" ) {
39
+ elem.style.position = "relative";
40
+ }
41
+
42
+ curOffset = curElem.offset();
43
+ curCSSTop = jQuery.css( elem, "top" );
44
+ curCSSLeft = jQuery.css( elem, "left" );
45
+ calculatePosition = ( position === "absolute" || position === "fixed" ) &&
46
+ jQuery.inArray( "auto", [ curCSSTop, curCSSLeft ] ) > -1;
47
+
48
+ // need to be able to calculate position if either top or left
49
+ // is auto and position is either absolute or fixed
50
+ if ( calculatePosition ) {
51
+ curPosition = curElem.position();
52
+ curTop = curPosition.top;
53
+ curLeft = curPosition.left;
54
+ } else {
55
+ curTop = parseFloat( curCSSTop ) || 0;
56
+ curLeft = parseFloat( curCSSLeft ) || 0;
57
+ }
58
+
59
+ if ( jQuery.isFunction( options ) ) {
60
+
61
+ // Use jQuery.extend here to allow modification of coordinates argument (gh-1848)
62
+ options = options.call( elem, i, jQuery.extend( {}, curOffset ) );
63
+ }
64
+
65
+ if ( options.top != null ) {
66
+ props.top = ( options.top - curOffset.top ) + curTop;
67
+ }
68
+ if ( options.left != null ) {
69
+ props.left = ( options.left - curOffset.left ) + curLeft;
70
+ }
71
+
72
+ if ( "using" in options ) {
73
+ options.using.call( elem, props );
74
+ } else {
75
+ curElem.css( props );
76
+ }
77
+ }
78
+ };
79
+
80
+ jQuery.fn.extend( {
81
+ offset: function( options ) {
82
+ if ( arguments.length ) {
83
+ return options === undefined ?
84
+ this :
85
+ this.each( function( i ) {
86
+ jQuery.offset.setOffset( this, options, i );
87
+ } );
88
+ }
89
+
90
+ var docElem, win,
91
+ box = { top: 0, left: 0 },
92
+ elem = this[ 0 ],
93
+ doc = elem && elem.ownerDocument;
94
+
95
+ if ( !doc ) {
96
+ return;
97
+ }
98
+
99
+ docElem = doc.documentElement;
100
+
101
+ // Make sure it's not a disconnected DOM node
102
+ if ( !jQuery.contains( docElem, elem ) ) {
103
+ return box;
104
+ }
105
+
106
+ // If we don't have gBCR, just use 0,0 rather than error
107
+ // BlackBerry 5, iOS 3 (original iPhone)
108
+ if ( typeof elem.getBoundingClientRect !== "undefined" ) {
109
+ box = elem.getBoundingClientRect();
110
+ }
111
+ win = getWindow( doc );
112
+ return {
113
+ top: box.top + ( win.pageYOffset || docElem.scrollTop ) - ( docElem.clientTop || 0 ),
114
+ left: box.left + ( win.pageXOffset || docElem.scrollLeft ) - ( docElem.clientLeft || 0 )
115
+ };
116
+ },
117
+
118
+ position: function() {
119
+ if ( !this[ 0 ] ) {
120
+ return;
121
+ }
122
+
123
+ var offsetParent, offset,
124
+ parentOffset = { top: 0, left: 0 },
125
+ elem = this[ 0 ];
126
+
127
+ // Fixed elements are offset from window (parentOffset = {top:0, left: 0},
128
+ // because it is its only offset parent
129
+ if ( jQuery.css( elem, "position" ) === "fixed" ) {
130
+
131
+ // we assume that getBoundingClientRect is available when computed position is fixed
132
+ offset = elem.getBoundingClientRect();
133
+ } else {
134
+
135
+ // Get *real* offsetParent
136
+ offsetParent = this.offsetParent();
137
+
138
+ // Get correct offsets
139
+ offset = this.offset();
140
+ if ( !jQuery.nodeName( offsetParent[ 0 ], "html" ) ) {
141
+ parentOffset = offsetParent.offset();
142
+ }
143
+
144
+ // Add offsetParent borders
145
+ parentOffset.top += jQuery.css( offsetParent[ 0 ], "borderTopWidth", true );
146
+ parentOffset.left += jQuery.css( offsetParent[ 0 ], "borderLeftWidth", true );
147
+ }
148
+
149
+ // Subtract parent offsets and element margins
150
+ // note: when an element has margin: auto the offsetLeft and marginLeft
151
+ // are the same in Safari causing offset.left to incorrectly be 0
152
+ return {
153
+ top: offset.top - parentOffset.top - jQuery.css( elem, "marginTop", true ),
154
+ left: offset.left - parentOffset.left - jQuery.css( elem, "marginLeft", true )
155
+ };
156
+ },
157
+
158
+ offsetParent: function() {
159
+ return this.map( function() {
160
+ var offsetParent = this.offsetParent;
161
+
162
+ while ( offsetParent && ( !jQuery.nodeName( offsetParent, "html" ) &&
163
+ jQuery.css( offsetParent, "position" ) === "static" ) ) {
164
+ offsetParent = offsetParent.offsetParent;
165
+ }
166
+ return offsetParent || documentElement;
167
+ } );
168
+ }
169
+ } );
170
+
171
+ // Create scrollLeft and scrollTop methods
172
+ jQuery.each( { scrollLeft: "pageXOffset", scrollTop: "pageYOffset" }, function( method, prop ) {
173
+ var top = /Y/.test( prop );
174
+
175
+ jQuery.fn[ method ] = function( val ) {
176
+ return access( this, function( elem, method, val ) {
177
+ var win = getWindow( elem );
178
+
179
+ if ( val === undefined ) {
180
+ return win ? ( prop in win ) ? win[ prop ] :
181
+ win.document.documentElement[ method ] :
182
+ elem[ method ];
183
+ }
184
+
185
+ if ( win ) {
186
+ win.scrollTo(
187
+ !top ? val : jQuery( win ).scrollLeft(),
188
+ top ? val : jQuery( win ).scrollTop()
189
+ );
190
+
191
+ } else {
192
+ elem[ method ] = val;
193
+ }
194
+ }, method, val, arguments.length, null );
195
+ };
196
+ } );
197
+
198
+ // Support: Safari<7-8+, Chrome<37-44+
199
+ // Add the top/left cssHooks using jQuery.fn.position
200
+ // Webkit bug: https://bugs.webkit.org/show_bug.cgi?id=29084
201
+ // getComputedStyle returns percent when specified for top/left/bottom/right
202
+ // rather than make the css module depend on the offset module, we just check for it here
203
+ jQuery.each( [ "top", "left" ], function( i, prop ) {
204
+ jQuery.cssHooks[ prop ] = addGetHookIf( support.pixelPosition,
205
+ function( elem, computed ) {
206
+ if ( computed ) {
207
+ computed = curCSS( elem, prop );
208
+
209
+ // if curCSS returns percentage, fallback to offset
210
+ return rnumnonpx.test( computed ) ?
211
+ jQuery( elem ).position()[ prop ] + "px" :
212
+ computed;
213
+ }
214
+ }
215
+ );
216
+ } );
217
+
218
+ return jQuery;
219
+ } );