"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "test/jqLiteSpec.js" between
angular.js-1.7.9.tar.gz and angular.js-1.8.0.tar.gz

About: AngularJS is a web application framework that assists with creating single-page applications that only require HTML, CSS, and JavaScript on the client side.

jqLiteSpec.js  (angular.js-1.7.9):jqLiteSpec.js  (angular.js-1.8.0)
skipping to change at line 139 skipping to change at line 139
expect(fragment.length).toBe(1); expect(fragment.length).toBe(1);
expect(fragment[0].nodeType).toBe(11); expect(fragment[0].nodeType).toBe(11);
}); });
it('should allow construction of <option> elements', function() { it('should allow construction of <option> elements', function() {
var nodes = jqLite('<option>'); var nodes = jqLite('<option>');
expect(nodes.length).toBe(1); expect(nodes.length).toBe(1);
expect(nodes[0].nodeName.toLowerCase()).toBe('option'); expect(nodes[0].nodeName.toLowerCase()).toBe('option');
}); });
it('should allow construction of multiple <option> elements', function() {
var nodes = jqLite('<option></option><option></option>');
expect(nodes.length).toBe(2);
expect(nodes[0].nodeName.toLowerCase()).toBe('option');
expect(nodes[1].nodeName.toLowerCase()).toBe('option');
});
// Special tests for the construction of elements which are restricted (in t he HTML5 spec) to // Special tests for the construction of elements which are restricted (in t he HTML5 spec) to
// being children of specific nodes. // being children of specific nodes.
forEach([ forEach([
'caption', 'caption',
'colgroup', 'colgroup',
'col', 'col',
'optgroup', 'optgroup',
'opt', 'opt',
'tbody', 'tbody',
'td', 'td',
skipping to change at line 160 skipping to change at line 167
'th', 'th',
'thead', 'thead',
'tr' 'tr'
], function(name) { ], function(name) {
it('should allow construction of <$NAME$> elements'.replace('$NAME$', name ), function() { it('should allow construction of <$NAME$> elements'.replace('$NAME$', name ), function() {
var nodes = jqLite('<$NAME$>'.replace('$NAME$', name)); var nodes = jqLite('<$NAME$>'.replace('$NAME$', name));
expect(nodes.length).toBe(1); expect(nodes.length).toBe(1);
expect(nodes[0].nodeName.toLowerCase()).toBe(name); expect(nodes[0].nodeName.toLowerCase()).toBe(name);
}); });
}); });
describe('security', function() {
it('shouldn\'t crash at attempts to close the table wrapper', function() {
// jQuery doesn't pass this test yet.
if (!_jqLiteMode) return;
// Support: IE <10
// In IE 9 we still need to use the old-style innerHTML assignment
// as that's the only one that works.
if (msie < 10) return;
expect(function() {
// This test case attempts to close the tags which wrap input
// based on matching done in wrapMap, escaping the wrapper & thus
// triggering an error when descending.
var el = jqLite('<td></td></tr></tbody></table><td></td>');
expect(el.length).toBe(2);
expect(el[0].nodeName.toLowerCase()).toBe('td');
expect(el[1].nodeName.toLowerCase()).toBe('td');
}).not.toThrow();
});
it('shouldn\'t unsanitize sanitized code', function(done) {
// jQuery <3.5.0 fail those tests.
if (isJQuery2x()) {
done();
return;
}
var counter = 0,
assertCount = 13,
container = jqLite('<div></div>');
function donePartial() {
counter++;
if (counter === assertCount) {
container.remove();
delete window.xss;
done();
}
}
jqLite(document.body).append(container);
window.xss = jasmine.createSpy('xss');
// Thanks to Masato Kinugawa from Cure53 for providing the following tes
t cases.
// Note: below test cases need to invoke the xss function with consecuti
ve
// decimal parameters for the assertions to be correct.
forEach([
'<img alt="<x" title="/><img src=url404 onerror=xss(0)>">',
'<img alt="\n<x" title="/>\n<img src=url404 onerror=xss(1)>">',
'<style><style/><img src=url404 onerror=xss(2)>',
'<xmp><xmp/><img src=url404 onerror=xss(3)>',
'<title><title /><img src=url404 onerror=xss(4)>',
'<iframe><iframe/><img src=url404 onerror=xss(5)>',
'<noframes><noframes/><img src=url404 onerror=xss(6)>',
'<noscript><noscript/><img src=url404 onerror=xss(7)>',
'<foo" alt="" title="/><img src=url404 onerror=xss(8)>">',
'<img alt="<x" title="" src="/><img src=url404 onerror=xss(9)>">',
'<noscript/><img src=url404 onerror=xss(10)>',
'<noembed><noembed/><img src=url404 onerror=xss(11)>',
'<option><style></option></select><img src=url404 onerror=xss(12)></st
yle>'
], function(htmlString, index) {
var element = jqLite('<div></div>');
container.append(element);
element.append(jqLite(htmlString));
window.setTimeout(function() {
expect(window.xss).not.toHaveBeenCalledWith(index);
donePartial();
}, 1000);
});
});
it('should allow to restore legacy insecure behavior', function() {
// jQuery doesn't have this API.
if (!_jqLiteMode) return;
// eslint-disable-next-line new-cap
angular.UNSAFE_restoreLegacyJqLiteXHTMLReplacement();
var elem = jqLite('<div/><span/>');
expect(elem.length).toBe(2);
expect(elem[0].nodeName.toLowerCase()).toBe('div');
expect(elem[1].nodeName.toLowerCase()).toBe('span');
});
});
}); });
describe('_data', function() { describe('_data', function() {
it('should provide access to the events present on the element', function() { it('should provide access to the events present on the element', function() {
var element = jqLite('<i>foo</i>'); var element = jqLite('<i>foo</i>');
expect(angular.element._data(element[0]).events).toBeUndefined(); expect(angular.element._data(element[0]).events).toBeUndefined();
element.on('click', function() { }); element.on('click', function() { });
expect(angular.element._data(element[0]).events.click).toBeDefined(); expect(angular.element._data(element[0]).events.click).toBeDefined();
}); });
 End of changes. 2 change blocks. 
0 lines changed or deleted 99 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)