This is an automated email from the ASF dual-hosted git repository.
carlosrovira pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/royale-asjs.git
The following commit(s) were added to refs/heads/develop by this push:
new 0f7153b addDynamicSelector: fix for IE11, also remove from
CheckBoxView
0f7153b is described below
commit 0f7153b0fc17b7c122eb71faec4c32d869af98de
Author: Carlos Rovira <[email protected]>
AuthorDate: Fri Jan 31 23:59:10 2020 +0100
addDynamicSelector: fix for IE11, also remove from CheckBoxView
---
.../src/main/royale/CheckBoxPlayGround.mxml | 4 +-
.../apache/royale/utils/css/addDynamicSelector.as | 13 +++---
.../royale/jewel/beads/views/CheckBoxView.as | 46 ++++++----------------
3 files changed, 20 insertions(+), 43 deletions(-)
diff --git
a/examples/royale/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
b/examples/royale/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
index 0849a20..1dfc9f1 100644
--- a/examples/royale/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
+++ b/examples/royale/TourDeJewel/src/main/royale/CheckBoxPlayGround.mxml
@@ -53,9 +53,9 @@ limitations under the License.
<j:CheckBox text="No size"/>
<j:CheckBox text="CheckWidth and checkHeight to
120" checkWidth="120" checkHeight="120"/>
<j:CheckBox text="Only checkWidth to 45"
checkWidth="45"/>
- <j:CheckBox text="Only checkHeight to 60 and
disabled" checkHeight="60">
+ <j:CheckBox text="Only checkHeight to 60 and
disabled" checkHeight="60" selected="true">
<j:beads>
- <j:Disabled id="opt3disable"
disabled="false"/>
+ <j:Disabled id="opt3disable"
disabled="true"/>
</j:beads>
</j:CheckBox>
</j:Card>
diff --git
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/css/addDynamicSelector.as
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/css/addDynamicSelector.as
index 0786b6d..8690962 100644
---
a/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/css/addDynamicSelector.as
+++
b/frameworks/projects/Core/src/main/royale/org/apache/royale/utils/css/addDynamicSelector.as
@@ -37,20 +37,21 @@ package org.apache.royale.utils.css
{
COMPILE::JS
{
- var selectorString:String = selector + ' { ' + rule + ' }'
+ var selectorString:String = selector + ' { ' + rule + ' }';
var element:HTMLStyleElement =
document.getElementById("royale_dynamic_css") as HTMLStyleElement;
if(element)
{
var sheet:CSSStyleSheet = element.sheet as CSSStyleSheet;
- sheet.insertRule(selectorString);
+ //for 'insertRule' below, the index (2nd) argument is not
optional in IE11, but is optional for modern browsers (with default value 0)
+ sheet.insertRule(selectorString, 0);
}
else
{
- var style:HTMLStyleElement =
document.createElement('style') as HTMLStyleElement;
- style.type = 'text/css';
+ var style:HTMLStyleElement = document.createElement('style')
as HTMLStyleElement;
+ style.type = 'text/css';
style.id = "royale_dynamic_css";
- style.innerHTML = selectorString;
-
document.getElementsByTagName('head')[0].appendChild(style);
+ style.innerHTML = selectorString;
+ document.getElementsByTagName('head')[0].appendChild(style);
}
}
}
diff --git
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/CheckBoxView.as
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/CheckBoxView.as
index 3f36ff1..4a4983f 100644
---
a/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/CheckBoxView.as
+++
b/frameworks/projects/Jewel/src/main/royale/org/apache/royale/jewel/beads/views/CheckBoxView.as
@@ -20,27 +20,26 @@ package org.apache.royale.jewel.beads.views
{
COMPILE::SWF
{
- import flash.display.Shape;
- import flash.display.SimpleButton;
- import flash.display.Sprite;
- import flash.text.TextFieldAutoSize;
- import flash.text.TextFieldType;
- import flash.events.Event;
+ import flash.display.Shape;
+ import flash.display.SimpleButton;
+ import flash.display.Sprite;
+ import flash.events.Event;
+ import flash.text.TextFieldAutoSize;
+ import flash.text.TextFieldType;
- import org.apache.royale.core.CSSTextField;
- import org.apache.royale.core.IToggleButtonModel;
+ import org.apache.royale.core.CSSTextField;
+ import org.apache.royale.core.IToggleButtonModel;
}
COMPILE::JS
{
- import org.apache.royale.events.IEventDispatcher;
- import org.apache.royale.events.Event;
+ import org.apache.royale.events.IEventDispatcher;
+ import org.apache.royale.events.Event;
}
import org.apache.royale.core.BeadViewBase;
import org.apache.royale.core.IStrand;
import org.apache.royale.core.UIBase;
import org.apache.royale.jewel.CheckBox;
- import org.apache.royale.core.IUIBase;
- // import org.apache.royale.utils.css.addDynamicSelector;
+ import org.apache.royale.utils.css.addDynamicSelector;
/**
* The CheckBoxView class is the default view for SWF platform
@@ -179,29 +178,6 @@ package org.apache.royale.jewel.beads.views
}
}
- public function addDynamicSelector(selector:String,
rule:String):void
- {
- COMPILE::JS
- {
- var selectorString:String = selector + ' { ' +
rule + ' }';
- var element:HTMLStyleElement =
document.getElementById("royale_dynamic_css") as HTMLStyleElement;
- if(element)
- {
- var sheet:CSSStyleSheet = element.sheet
as CSSStyleSheet;
- //for 'insertRule' below, the index
(2nd) argument is not optional in IE11, but is optional for modern browsers
(with default value 0)
- sheet.insertRule(selectorString, 0);
- }
- else
- {
- var style:HTMLStyleElement =
document.createElement('style') as HTMLStyleElement;
- style.type = 'text/css';
- style.id = "royale_dynamic_css";
- style.innerHTML = selectorString;
-
document.getElementsByTagName('head')[0].appendChild(style);
- }
- }
- }
-
/**
* @private
* @royaleignorecoercion org.apache.royale.core.UIBase