{"action":"opened","issue":{"url":"https://api.github.com/repos/WestpacCXTeam/GUI-source/issues/162","labels_url":"https://api.github.com/repos/WestpacCXTeam/GUI-source/issues/162/labels{/name}","comments_url":"https://api.github.com/repos/WestpacCXTeam/GUI-source/issues/162/comments","events_url":"https://api.github.com/repos/WestpacCXTeam/GUI-source/issues/162/events","html_url":"https://github.com/WestpacCXTeam/GUI-source/issues/162","id":119105275,"number":162,"title":"Adding feature detection to javascript-helpers","user":{"login":"dominikwilkowski","id":1266923,"avatar_url":"https://avatars.githubusercontent.com/u/1266923?v=3","gravatar_id":"","url":"https://api.github.com/users/dominikwilkowski","html_url":"https://github.com/dominikwilkowski","followers_url":"https://api.github.com/users/dominikwilkowski/followers","following_url":"https://api.github.com/users/dominikwilkowski/following{/other_user}","gists_url":"https://api.github.com/users/dominikwilkowski/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikwilkowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikwilkowski/subscriptions","organizations_url":"https://api.github.com/users/dominikwilkowski/orgs","repos_url":"https://api.github.com/users/dominikwilkowski/repos","events_url":"https://api.github.com/users/dominikwilkowski/events{/privacy}","received_events_url":"https://api.github.com/users/dominikwilkowski/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/WestpacCXTeam/GUI-source/labels/_javascript-helpers","name":"_javascript-helpers","color":"5319e7"}],"state":"open","locked":false,"assignee":{"login":"dominikwilkowski","id":1266923,"avatar_url":"https://avatars.githubusercontent.com/u/1266923?v=3","gravatar_id":"","url":"https://api.github.com/users/dominikwilkowski","html_url":"https://github.com/dominikwilkowski","followers_url":"https://api.github.com/users/dominikwilkowski/followers","following_url":"https://api.github.com/users/dominikwilkowski/following{/other_user}","gists_url":"https://api.github.com/users/dominikwilkowski/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikwilkowski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikwilkowski/subscriptions","organizations_url":"https://api.github.com/users/dominikwilkowski/orgs","repos_url":"https://api.github.com/users/dominikwilkowski/repos","events_url":"https://api.github.com/users/dominikwilkowski/events{/privacy}","received_events_url":"https://api.github.com/users/dominikwilkowski/received_events","type":"User","site_admin":false},"milestone":null,"comments":0,"created_at":"2015-11-26T21:59:09Z","updated_at":"2015-11-26T21:59:09Z","closed_at":null,"body":"I would like to add a method to the core js to detect CSS features.\r\nThe method would test for the feature being available in the browser, add a class to the document respectively and return true or false.\r\nWe can then use it in modules to test for support. The downside is we would have to add JS to each module that needs a test.\r\n\r\nHave a look and let me know if there are any issues with it.\r\n\r\n```js\r\n//----------------------------------------------------------------------------------------------------------------------------------------------------------\r\n// detect CSS feature and add class to document\r\n//\r\n// @param   feature  [string]  Feature to detect\r\n//\r\n// @return  [boolean]\r\n//----------------------------------------------------------------------------------------------------------------------------------------------------------\r\ndebounce: function detectCSS( feature ) {\r\n\tGUI.debugging( 'Base: detectCSS called', 'report' );\r\n\r\n\tvar _hasSupport = false; //assuming the worst\r\n\tvar browserPrefixes = ['Webkit', 'Moz', 'ms', 'O']; //browser prefixes\r\n\r\n\tfeature = feature.toLowerCase(); //normalize\r\n\tvar featureCapital = feature.charAt(0).toUpperCase() + feature.substr(1); //Sentence case\r\n\r\n\tvar $test = $('<div/>'); //create test element\r\n\r\n\tif( $test.style[ feature ] != undefined ) {\r\n\t\t_hasSupport = true; //feature is available without prefix\r\n\t}\r\n\r\n\tfor(var i = 0; i < browserPrefixes.length; i++) { //testing all browser prefixes\r\n\t\tif( $test.style[ browserPrefixes[i] + featureCapital ] != undefined )\r\n\t\t\t_hasSupport = true; //feature is available with prefix\r\n\t}\r\n\r\n\tif( _hasSupport ) {\r\n\t\t$('html').addClass( feature );\r\n\t}\r\n\telse {\r\n\t\t$('html').addClass( 'no-' + feature );\r\n\t}\r\n\r\n\treturn _hasSupport;\r\n},\r\n```"}}