Skip to content

Commit e6bda6a

Browse files
committed
Add jQuery.boxModel and jQuery.support.boxModel. Close jquerygh-41.
1 parent d87d7ec commit e6bda6a

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

src/core.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,11 @@ if ( !jQuery.browser ) {
8686
// Warn if the code tries to get jQuery.browser
8787
migrateWarnProp( jQuery, "browser", jQuery.browser, "jQuery.browser is deprecated" );
8888

89+
// jQuery.boxModel deprecated in 1.3, jQuery.support.boxModel deprecated in 1.7
90+
jQuery.boxModel = jQuery.support.boxModel = (document.compatMode === "CSS1Compat");
91+
migrateWarnProp( jQuery, "boxModel", jQuery.boxModel, "jQuery.boxModel is deprecated" );
92+
migrateWarnProp( jQuery.support, "boxModel", jQuery.support.boxModel, "jQuery.support.boxModel is deprecated" );
93+
8994
jQuery.sub = function() {
9095
function jQuerySub( selector, context ) {
9196
return new jQuerySub.fn.init( selector, context );

test/core.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,15 @@ test( "jQuery.browser", function() {
133133
});
134134
});
135135

136+
test( "jQuery.boxModel and jQuery.support.boxModel", function() {
137+
expect( 3 );
138+
139+
( jQuery._definePropertyBroken ? expectNoWarning : expectWarning )( "boxModel", 2, function() {
140+
equal( jQuery.boxModel, true, "jQuery.boxModel is true (not in Quirks)" );
141+
equal( jQuery.support.boxModel, true, "jQuery.support.boxModel is true (not in Quirks)" );
142+
});
143+
});
144+
136145
test( "jQuery.sub() - Static Methods", function(){
137146
expect( 19 );
138147

warnings.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,13 @@ This is _not_ a warning, but a console log message the plugin shows when it firs
4242

4343
**Solution:** Put a [valid doctype](http://www.w3.org/QA/2002/04/valid-dtd-list.html) in the document and ensure that the document is rendering in standards mode. The simplest valid doctype is the HTML5 one, which we highly recommend: `<!doctype html>` . The jQuery Migrate plugin does not attempt to fix issues related to quirks mode.
4444

45+
### JQMIGRATE: jQuery.boxModel is deprecated
46+
### JQMIGRATE: jQuery.support.boxModel is deprecated
47+
48+
**Cause:** These two deprecated properties are `false` when the page is using Quirks mode, and `true` when the page is in standards mode. Quirks mode was never supported in jQuery so these properties were removed.
49+
50+
**Solution:** Do not use jQuery in Quirks, it has never been supported. See the previous item for solutions.
51+
4552
### JQMIGRATE: jQuery.parseJSON requires a valid JSON string
4653

4754
**Cause**: Before jQuery 1.9.0, the `$.parseJSON()` method allowed some invalid JSON strings and returned `null` as a result without throwing an error. This put it at odds with the `JSON.parse()` method. The two methods are aligned as of 1.9.0 and values such as an empty string are properly not considered valid by `$.parseJSON()`.

0 commit comments

Comments
 (0)