Skip to content

Commit

Permalink
Merge pull request #19 from supportkit/integration
Browse files Browse the repository at this point in the history
0.2.8 Release
  • Loading branch information
lemieux committed Jun 25, 2015
2 parents 99fa8f1 + cbf17cf commit e7f50fc
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 13 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"backbone-computedfields": "0.0.10",
"backbone.marionette": "^2.4.1",
"backbone.stickit": "^0.9.2",
"browsernizr": "^1.0.2",
"cookie": "^0.1.2",
"faye": "^1.1.1",
"jquery": "~1.11.0",
Expand Down
3 changes: 3 additions & 0 deletions release_notes/v0.2.8.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Changes

1. Replaced Modernizr by a simpler script to prevent potential clashes/crashes.
14 changes: 5 additions & 9 deletions src/js/bootstrap.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
'use strict';

/**
* Browser compatibility
*/
require('browsernizr/test/css/transforms');
require('browsernizr');

var $ = require('jquery');
// Enable CORS for IE8
window.$.support.cors = true;
$.support.cors = true;

require('./utils/jquery.support.cssproperty');

// Polyfill Object.getPrototypeOf
// http://ejohn.org/blog/objectgetprototypeof/
Expand All @@ -27,8 +24,7 @@ if (typeof Object.getPrototypeOf !== 'function') {
/**
* Marionette setup
*/
var Backbone = require('backbone'),
$ = require('jquery');
var Backbone = require('backbone');
Backbone.$ = $;
var Marionette = require('backbone.marionette');

Expand Down
5 changes: 2 additions & 3 deletions src/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
require('./bootstrap');

var Marionette = require('backbone.marionette'),
Modernizr = require('browsernizr'),
_ = require('underscore'),
$ = require('jquery'),
cookie = require('cookie'),
Expand Down Expand Up @@ -56,9 +55,9 @@ var SupportKit = Marionette.Object.extend({
init: function(options) {
// TODO: alternatively load fallback CSS that doesn't use
// unsupported things like transforms
if (!Modernizr.csstransforms) {
if (!$.support.cssProperty('transform')) {
console.error('SupportKit is not supported on this browser. ' +
'Missing capability: csstransforms');
'Missing capability: css-transform');
return;
}

Expand Down
53 changes: 53 additions & 0 deletions src/js/utils/jquery.support.cssproperty.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
'use strict';

var $ = require('jquery');

// https://gist.github.com/jackfuchs/556448

/**
* jQuery.support.cssProperty
* To verify that a CSS property is supported (or any of its browser-specific implementations)
*
* @param string p - css property name
* [@param] bool rp - optional, if set to true, the css property name will be returned, instead of a boolean support indicator
*
* @Author: Axel Jack Fuchs (Cologne, Germany)
* @Date: 08-29-2010 18:43
*
* Example: $.support.cssProperty('boxShadow');
* Returns: true
*
* Example: $.support.cssProperty('boxShadow', true);
* Returns: 'MozBoxShadow' (On Firefox4 beta4)
* Returns: 'WebkitBoxShadow' (On Safari 5)
*/
$.support.cssProperty = (function() {
function cssProperty(p, rp) {
var b = document.body || document.documentElement,
s = b.style;

// No css support detected
if (typeof s == 'undefined') {
return false;
}

// Tests for standard prop
if (typeof s[p] == 'string') {
return rp ? p : true;
}

// Tests for vendor specific prop
var v = ['Moz', 'Webkit', 'Khtml', 'O', 'ms', 'Icab'],
p = p.charAt(0).toUpperCase() + p.substr(1);

for (var i = 0; i < v.length; i++) {
if (typeof s[v[i] + p] == 'string') {
return rp ? (v[i] + p) : true;
}
}

return false;
}

return cssProperty;
})();

0 comments on commit e7f50fc

Please sign in to comment.