Skip to content

Commit 020eab2

Browse files
Merge branch 'master' of github.com:sstephenson/prototype
2 parents 00f4a2b + 7d4184e commit 020eab2

File tree

5 files changed

+32
-22
lines changed

5 files changed

+32
-22
lines changed

src/prototype/ajax.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@
6363
* * `requestHeaders` ([[Object]]): A set of key-value pairs, with properties
6464
* representing header names.
6565
* * `evalJS` ([[Boolean]] | [[String]]; default `true`): Automatically `eval`s
66+
* the content of [[Ajax.Response#responseText]] if the `Content-type` returned
67+
* by the server is set to one of `text/javascript`, `application/ecmascript`
68+
* (matches expression `(text|application)\/(x-)?(java|ecma)script`).
69+
* If the request doesn't obey same-origin policy, the content is not evaluated.
70+
* If you need to force evalutation, pass `'force'`. To prevent it altogether,
71+
* pass `false`.
72+
* * `evalJSON` ([[Boolean]] | [[String]]; default `true`): Automatically `eval`s
6673
* the content of [[Ajax.Response#responseText]] and populates
6774
* [[Ajax.Response#responseJSON]] with it if the `Content-type` returned by
6875
* the server is set to `application/json`. If the request doesn't obey

src/prototype/dom/layout.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
(function() {
32

43
// Converts a CSS percentage value to a decimal.
@@ -1504,20 +1503,24 @@
15041503
// Find page position of source.
15051504
source = $(source);
15061505
element = $(element);
1507-
var p = Element.viewportOffset(source), delta = [0, 0];
1508-
1509-
// A delta of 0/0 will work for `positioned: fixed` elements, but
1510-
// for `position: absolute` we need to get the parent's offset.
1511-
if (Element.getStyle(element, 'position') === 'absolute') {
1512-
var parent = Element.getOffsetParent(element);
1513-
if (parent !== document.body) delta = Element.viewportOffset(parent);
1506+
var p, delta, layout, styles = {};
1507+
1508+
if (options.setLeft || options.setTop) {
1509+
p = Element.viewportOffset(source);
1510+
delta = [0, 0];
1511+
// A delta of 0/0 will work for `positioned: fixed` elements, but
1512+
// for `position: absolute` we need to get the parent's offset.
1513+
if (Element.getStyle(element, 'position') === 'absolute') {
1514+
var parent = Element.getOffsetParent(element);
1515+
if (parent !== document.body) delta = Element.viewportOffset(parent);
1516+
}
15141517
}
1515-
1516-
var layout = Element.getLayout(source);
1517-
1518+
1519+
if (options.setWidth || options.setHeight) {
1520+
layout = Element.getLayout(source);
1521+
}
1522+
15181523
// Set position.
1519-
var styles = {};
1520-
15211524
if (options.setLeft)
15221525
styles.left = (p[0] - delta[0] + options.offsetLeft) + 'px';
15231526
if (options.setTop)

src/prototype/lang/object.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,9 @@
190190
case 'object':
191191

192192
for (var i = 0, length = stack.length; i < length; i++) {
193-
if (stack[i] === value) { throw new TypeError(); }
193+
if (stack[i] === value) {
194+
throw new TypeError("Cyclic reference to '" + value + "' in object");
195+
}
194196
}
195197
stack.push(value);
196198

src/prototype/lang/string.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Object.extend(String.prototype, (function() {
177177
* ##### Examples
178178
*
179179
* 'apple, pear & orange'.scan(/\w+/, alert);
180-
* // -> 'apple pear orange' (and displays 'apple', 'pear' and 'orange' in three successive alert dialogs)
180+
* // -> 'apple pear & orange' (and displays 'apple', 'pear' and 'orange' in three successive alert dialogs)
181181
*
182182
* Can be used to populate an array:
183183
*
@@ -382,11 +382,9 @@ Object.extend(String.prototype, (function() {
382382
* }
383383
*
384384
* (You can leave off the `window.` part of that, but it's bad form.)
385-
* Evaluates the content of any `script` block present in the string. Returns
386-
* an array containing the value returned by each script.
387385
**/
388386
function evalScripts() {
389-
return this.extractScripts().map(function(script) { return eval(script) });
387+
return this.extractScripts().map(function(script) { return eval(script); });
390388
}
391389

392390
/** related to: String#unescapeHTML
@@ -451,7 +449,7 @@ Object.extend(String.prototype, (function() {
451449
* 'section=blog&id=45'.toQueryParams();
452450
* // -> {section: 'blog', id: '45'}
453451
*
454-
* 'section=blog;id=45'.toQueryParams();
452+
* 'section=blog;id=45'.toQueryParams(';');
455453
* // -> {section: 'blog', id: '45'}
456454
*
457455
* 'http://www.example.com?section=blog&id=45#comments'.toQueryParams();

test/unit/selector_test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,9 @@ new Test.Unit.Runner({
285285
},
286286

287287
testSelectorWithEnabledDisabledChecked: function() {
288-
this.assertEnumEqual([$('disabled_text_field')], $$('#troubleForm > *:disabled'));
289-
this.assertEnumEqual($('troubleForm').getInputs().without($('disabled_text_field'), $('hidden')), $$('#troubleForm > *:enabled'));
290-
this.assertEnumEqual($('checked_box', 'checked_radio'), $$('#troubleForm *:checked'));
288+
this.assertEnumEqual([$('disabled_text_field')], $$('#troubleForm > *:disabled'), ':disabled');
289+
this.assertEnumEqual($('troubleForm').getInputs().without($('disabled_text_field'), $('hidden')), $$('#troubleForm > *:enabled'), ':enabled');
290+
this.assertEnumEqual($('checked_box', 'checked_radio'), $$('#troubleForm *:checked'), ':checked');
291291
},
292292

293293
testSelectorWithEmpty: function() {

0 commit comments

Comments
 (0)