Skip to content

Commit

Permalink
Fix IE8 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Fedik committed Aug 21, 2016
1 parent b528028 commit a97c69d
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libraries/joomla/document/renderer/html/head.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ public function fetchHead($document)

if (!empty($scriptOptions))
{
$buffer .= $tab . '<script type="application/json" id="joomla-script-options">';
$buffer .= $tab . '<script type="application/json" class="joomla-script-options new">';

$prettyPrint = (JDEBUG && defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : false);
$jsonOptions = json_encode($scriptOptions, $prettyPrint);
Expand Down
4 changes: 2 additions & 2 deletions media/system/js/core-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Joomla.editors.instances = Joomla.editors.instances || {};
Joomla.loadOptions = function( options ) {
// Load form the script container
if (!options) {
var elements = document.getElementsByClassName('joomla-script-options-new'),
var elements = document.querySelectorAll('.joomla-script-options.new'),
str, element, option;

for (var i = 0, l = elements.length; i < l; i++) {
Expand All @@ -119,7 +119,7 @@ Joomla.editors.instances = Joomla.editors.instances || {};

option ? Joomla.loadOptions(option) : null;

element.className = 'joomla-script-options-loaded';
element.className = element.className.replace(' new', ' loaded');
}

return;
Expand Down
2 changes: 1 addition & 1 deletion media/system/js/core.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion tests/javascript/core/fixtures/fixture.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</form>
</div>
<div id="get-options">
<script type="application/json" class="joomla-script-options-new">{
<script type="application/json" class="joomla-script-options new">{
"com_foobar": ["my options"],
"com_foobar2": "Alert message!",
"com_foobar3": false
Expand Down
18 changes: 9 additions & 9 deletions tests/javascript/core/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -216,20 +216,20 @@ define(['jquery', 'testsRoot/core/spec-setup', 'jasmineJquery'], function ($) {
expect(Joomla.getOptions("com_foobar4", 123)).toEqual(123)
});

// Test dynamically added options
it('should return dynamically added options Joomla.getOptions("com_foobar5")', function () {
// Test dynamically added options
it('should return dynamically added options Joomla.getOptions("com_foobar5")', function () {
$('#get-options').append($('<script>', {
type: 'application/json',
'class': 'joomla-script-options-new',
text: '{"com_foobar5": true}'
type: 'application/json',
'class': 'joomla-script-options new',
text: '{"com_foobar5": true}'
}));
Joomla.loadOptions();

expect(Joomla.getOptions("com_foobar5")).toEqual(true)
});
it('amount of the loaded options containers should equal 2', function () {
expect($('.joomla-script-options-loaded').length).toEqual(2)
});
});
it('amount of the loaded options containers should equal 2', function () {
expect($('.joomla-script-options.loaded').length).toEqual(2)
});

});
});

0 comments on commit a97c69d

Please sign in to comment.