diff options
-rw-r--r-- | uitest/src/com/vaadin/tests/util/TestUtils.java | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/uitest/src/com/vaadin/tests/util/TestUtils.java b/uitest/src/com/vaadin/tests/util/TestUtils.java index 5c6315a23a..dcd28c3413 100644 --- a/uitest/src/com/vaadin/tests/util/TestUtils.java +++ b/uitest/src/com/vaadin/tests/util/TestUtils.java @@ -99,22 +99,13 @@ public class TestUtils { "YE", "ZAMBIA", "ZM", "ZIMBABWE", "ZW" }; /** - * Crossbrowser hack to dynamically add css current window. Can be used to - * keep tests css in source files. + * Injects css into the current window. Can be used to keep tests css in + * source files. * * @param cssString */ public static void injectCSS(UI w, String cssString) { - String script = "if ('\\v'=='v') /* ie only */ {\n" - + " document.createStyleSheet().cssText = '" - + cssString - + "';\n" - + " } else {var tag = document.createElement('style'); tag.type = 'text/css';" - + " document.getElementsByTagName('head')[0].appendChild(tag);tag[ (typeof " - + "document.body.style.WebkitAppearance=='string') /* webkit only */ ? 'innerText' " - + ": 'innerHTML'] = '" + cssString + "';}"; - - w.getPage().getJavaScript().execute(script); + w.getPage().getStyles().add(cssString); } public static void installPerformanceReporting(TextArea targetTextArea) { |