Skip to content

Commit

Permalink
Remove IE8 support (#353)
Browse files Browse the repository at this point in the history
  • Loading branch information
matteofigus authored and nickbalestra committed Jan 18, 2017
1 parent f6b6926 commit 2856a61
Show file tree
Hide file tree
Showing 18 changed files with 30 additions and 139 deletions.
1 change: 0 additions & 1 deletion client/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,6 @@ Options:
|`disableFailoverRendering`|`boolean`|no|Disables the automatic failover rendering in case the registry times-out (in case configuration.registries.clientRendering contains a valid value.) Default false|
|`forwardAcceptLanguageToClient`|`boolean`|no|When not specified in config, defaults to false. When true, when doing client-side requests (normal or failover) appends a custom parameter to the browser's component hrefs so that the framework will ignore the browser's Accept-Language in favour of the query-string value|
|`headers`|`object`|no|An object containing all the headers that must be forwarded to the component|
|`ie8`|`boolean`|no|Default false, if true puts in place the necessary polyfills to make all the stuff work with ie8|
|`parameters`|`object`|no|An object containing the parameters for component's request|
|`registries`|`object`|no|The registries' endpoints (overrides the parameters defined during instantiation)|
|`registries.serverRendering`|`string`|no|The baseUrl for server-side rendering requests (overrides the parameter defined during instantiation)|
Expand Down
7 changes: 1 addition & 6 deletions client/src/html-renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ module.exports = {
return data.html;
},
unrenderedComponent: function(href, options){
if(!href){ return ''; }

var youCareAboutIe8 = !!options && !!options.ie8,
template = templates['componentUnrenderedTag' + (youCareAboutIe8 ? 'Ie8' : '')];

return format(template, href);
return href ? format(templates.componentUnrenderedTag, href) : '';
}
};
2 changes: 1 addition & 1 deletion client/src/oc-client.min.js

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions client/src/templates.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,6 @@ module.exports = {

componentUnrenderedTag: '<oc-component href="{0}"></oc-component>',

componentUnrenderedTagIe8: '<script class="ocComponent">(function($d,$w,oc){var href=\'href="{0}"\';' +
'$d.write((!!$w.navigator.userAgent.match(/MSIE 8/))?(\'<div data-oc-component="true" \'+href+\'>' +
'</div>\'):(\'<oc-component \'+href+\'></oc-component>\'));if(oc) oc.renderUnloadedComponents();}' +
'(document,window,((typeof(oc)===\'undefined\')?undefined:oc)));</script>',

renderInfo: '<script>window.oc=window.oc||{};oc.renderedComponents=oc.renderedComponents||{};' +
'oc.renderedComponents["{0}"]="{1}";</script>'
};
3 changes: 1 addition & 2 deletions src/cli/domain/package-static-files.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ var minifyFile = function(fileType, fileContent, ocOptions){
if(fileType === '.js'){
return uglifyJs.minify(fileContent, { fromString: true }).code;
} else if(fileType === '.css'){
var options = (ocOptions.ie8css === true) ? { compatibility:'ie8' } : null;
return new CleanCss(options).minify(fileContent).styles;
return new CleanCss().minify(fileContent).styles;
}

return fileContent;
Expand Down
2 changes: 1 addition & 1 deletion src/components/oc-client/_package/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,6 @@
},
"version": "0.33.31",
"packaged": true,
"date": 1484679018714
"date": 1484742948044
}
}
12 changes: 5 additions & 7 deletions src/components/oc-client/_package/src/oc-client.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var oc = oc || {};

// Constants
var CDNJS_BASEURL = 'https://cdnjs.cloudflare.com/ajax/libs/',
IE89_AJAX_POLYFILL_URL = CDNJS_BASEURL + 'jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js',
IE9_AJAX_POLYFILL_URL = CDNJS_BASEURL + 'jquery-ajaxtransport-xdomainrequest/1.0.3/jquery.xdomainrequest.min.js',
HANDLEBARS_URL = CDNJS_BASEURL + 'handlebars.js/4.0.5/handlebars.runtime.min.js',
JADE_URL = CDNJS_BASEURL + 'jade/1.11.0/runtime.min.js',
JQUERY_URL = CDNJS_BASEURL + 'jquery/1.11.2/jquery.min.js',
Expand All @@ -57,7 +57,6 @@ var oc = oc || {};
headScripts = [],
noop = function(){},
nav = $window.navigator.userAgent,
is8 = !!(nav.match(/MSIE 8/)),
is9 = !!(nav.match(/MSIE 9/)),
initialised = false,
initialising = false,
Expand Down Expand Up @@ -216,7 +215,7 @@ var oc = oc || {};
href = href.slice(0, -1);
}

return is8 ? '<div data-oc-component="true" href="' + href + '"></div>' : '<' + OC_TAG + ' href="' + href + '"></' + OC_TAG + '>';
return '<' + OC_TAG + ' href="' + href + '"></' + OC_TAG + '>';
};

oc.events = {};
Expand All @@ -232,8 +231,8 @@ var oc = oc || {};
initialising = true;

var requirePolyfills = function($, cb){
if((is8 || is9) && !$.IE_POLYFILL_LOADED){
oc.require(IE89_AJAX_POLYFILL_URL, cb);
if(is9 && !$.IE_POLYFILL_LOADED){
oc.require(IE9_AJAX_POLYFILL_URL, cb);
} else {
cb();
}
Expand Down Expand Up @@ -422,8 +421,7 @@ var oc = oc || {};

oc.renderUnloadedComponents = function(){
oc.ready(function(){
var selector = (is8 ? 'div[data-oc-component=true]' : OC_TAG),
$unloadedComponents = oc.$(selector + '[data-rendered!=true]'),
var $unloadedComponents = oc.$(OC_TAG + '[data-rendered!=true]'),
toDo = $unloadedComponents.length;

var done = function(cb){
Expand Down
2 changes: 1 addition & 1 deletion src/components/oc-client/_package/src/oc-client.min.js

Large diffs are not rendered by default.

Loading

0 comments on commit 2856a61

Please sign in to comment.