From: <rb...@us...> - 2013-07-07 13:57:53
|
Revision: 8379 http://sourceforge.net/p/htmlunit/code/8379 Author: rbri Date: 2013-07-07 13:57:50 +0000 (Sun, 07 Jul 2013) Log Message: ----------- more defaults for the display property fixed Modified Paths: -------------- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java Modified: trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java =================================================================== --- trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-07-06 16:29:28 UTC (rev 8378) +++ trunk/htmlunit/src/main/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclaration.java 2013-07-07 13:57:50 UTC (rev 8379) @@ -173,6 +173,12 @@ map.put("MAP", "inline"); map.put("MARK", "inline"); map.put("METER", "inline"); + map.put("NAV", "inline"); + // map.put("NOSCRIPT", "inline"); + map.put("OBJECT", "inline"); + map.put("OPTGROUP", "inline"); + map.put("OPTION", "inline"); + map.put("OUTPUT", "inline"); map.put("SPAN", "inline"); @@ -197,6 +203,10 @@ map.put("INPUT", "inline"); map.put("LEGEND", "block"); map.put("METER", "inline-block"); + map.put("NAV", "block"); + // map.put("NOSCRIPT", "none"); + map.put("OPTGROUP", "block"); + map.put("OPTION", "block"); DEFAULT_DISPLAYS_CSS = Collections.unmodifiableMap(map); } Modified: trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java =================================================================== --- trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-07-06 16:29:28 UTC (rev 8378) +++ trunk/htmlunit/src/test/java/com/gargoylesoftware/htmlunit/javascript/host/css/ComputedCSSStyleDeclarationTest.java 2013-07-07 13:57:50 UTC (rev 8379) @@ -271,19 +271,20 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('a'));\n" - + " alert(x('abbr'));\n" - + " alert(x('acronym'));\n" - + " alert(x('address'));\n" - // + " alert(x('applet'));\n" - + " alert(x('area'));\n" - + " alert(x('article'));\n" - + " alert(x('aside'));\n" - + " alert(x('audio'));\n" + + " x('a');\n" + + " x('abbr');\n" + + " x('acronym');\n" + + " x('address');\n" + // + " x('applet');\n" + + " x('area');\n" + + " x('article');\n" + + " x('aside');\n" + + " x('audio');\n" + " </script>\n" + "</body></html>"; loadPageWithAlerts2(html); @@ -309,18 +310,19 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('b'));\n" - // + " alert(x('bdi'));\n" + + " x('b');\n" + // + " x('bdi');\n" - + " alert(x('bdo'));\n" - + " alert(x('big'));\n" - + " alert(x('blockquote'));\n" - + " alert(x('br'));\n" - + " alert(x('button'));\n" + + " x('bdo');\n" + + " x('big');\n" + + " x('blockquote');\n" + + " x('br');\n" + + " x('button');\n" + " </script>\n" + "</body></html>"; loadPageWithAlerts2(html); @@ -355,18 +357,19 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('canvas'));\n" - + " alert(x('caption'));\n" - + " alert(x('center'));\n" - + " alert(x('cite'));\n" - + " alert(x('code'));\n" - + " alert(x('col'));\n" - + " alert(x('colgroup'));\n" - // + " alert(x('command'));\n" + + " x('canvas');\n" + + " x('caption');\n" + + " x('center');\n" + + " x('cite');\n" + + " x('code');\n" + + " x('col');\n" + + " x('colgroup');\n" + // + " x('command');\n" + " </script>\n" + "</body></html>"; loadPageWithAlerts2(html); @@ -399,20 +402,21 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - // + " alert(x('datalist'));\n" - + " alert(x('dd'));\n" - + " alert(x('del'));\n" - // + " alert(x('details'));\n" - + " alert(x('dfn'));\n" - // + " alert(x('dialog'));\n" - + " alert(x('dir'));\n" - + " alert(x('div'));\n" - + " alert(x('dl'));\n" - + " alert(x('dt'));\n" + // + " x('datalist');\n" + + " x('dd');\n" + + " x('del');\n" + // + " x('details');\n" + + " x('dfn');\n" + // + " x('dialog');\n" + + " x('dir');\n" + + " x('div');\n" + + " x('dl');\n" + + " x('dt');\n" + " </script>\n" + "</body></html>"; @@ -435,12 +439,13 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('em'));\n" - + " alert(x('embed'));\n" + + " x('em');\n" + + " x('embed');\n" + " </script>\n" + "</body></html>"; @@ -472,16 +477,17 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('fieldset'));\n" - + " alert(x('figcaption'));\n" - + " alert(x('figure'));\n" - + " alert(x('font'));\n" - + " alert(x('footer'));\n" - + " alert(x('form'));\n" + + " x('fieldset');\n" + + " x('figcaption');\n" + + " x('figure');\n" + + " x('font');\n" + + " x('footer');\n" + + " x('form');\n" + " </script>\n" + "</body></html>"; @@ -509,18 +515,19 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('h1'));\n" - + " alert(x('h2'));\n" - + " alert(x('h3'));\n" - + " alert(x('h4'));\n" - + " alert(x('h5'));\n" - + " alert(x('h6'));\n" - + " alert(x('header'));\n" - + " alert(x('hr'));\n" + + " x('h1');\n" + + " x('h2');\n" + + " x('h3');\n" + + " x('h4');\n" + + " x('h5');\n" + + " x('h6');\n" + + " x('header');\n" + + " x('hr');\n" + " </script>\n" + "</body></html>"; @@ -557,22 +564,23 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('i'));\n" - + " alert(x('iframe'));\n" - + " alert(x('img'));\n" + + " x('i');\n" + + " x('iframe');\n" + + " x('img');\n" - + " alert(x('submit'));\n" - + " alert(x('reset'));\n" - + " alert(x('text'));\n" - + " alert(x('password'));\n" - + " alert(x('checkbox'));\n" - + " alert(x('radio'));\n" + + " x('submit');\n" + + " x('reset');\n" + + " x('text');\n" + + " x('password');\n" + + " x('checkbox');\n" + + " x('radio');\n" - + " alert(x('ins'));\n" + + " x('ins');\n" + " </script>\n" + "</body></html>"; @@ -607,16 +615,17 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('kbd'));\n" - + " alert(x('keygen'));\n" + + " x('kbd');\n" + + " x('keygen');\n" - + " alert(x('label'));\n" - + " alert(x('legend'));\n" - + " alert(x('li'));\n" + + " x('label');\n" + + " x('legend');\n" + + " x('li');\n" + " </script>\n" + "</body></html>"; @@ -650,14 +659,15 @@ + " <script>\n" + " function x(id) {\n" + " var e = document.getElementById(id);\n" - + " return e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + " }\n" + " </script>\n" + " <script>\n" - + " alert(x('map'));\n" - + " alert(x('mark'));\n" - + " alert(x('menu'));\n" - + " alert(x('meter'));\n" + + " x('map');\n" + + " x('mark');\n" + + " x('menu');\n" + + " x('meter');\n" + " </script>\n" + "</body></html>"; @@ -668,6 +678,57 @@ * @throws Exception if an error occurs */ @Test + @Alerts(DEFAULT = { "block", "none", "inline", "block", "block", "block", "inline" }, + IE = { "inline", "inline", "inline", "block", "inline", "inline", "inline" }) + @NotYetImplemented + public void defaultDisplayValues_NO() throws Exception { + final String html = "<!DOCTYPE HTML>\n<html><body>\n" + + " <nav id='nav'>\n" + + " <a id='a'></a>\n" + + " </nav>\n" + + + " <noscript id='noscript'></noscript> \n" + + + " <object id='object'></object> " + + " <ol id='ol'>\n" + + " <li></li>\n" + + " </ol>\n" + + + " <form>\n" + + " <select>\n" + + " <optgroup id='optgroup'>\n" + + " <option></option>\n" + + " </optgroup>\n" + + " <option id='option'></option>\n" + + " </select>\n" + + " <output id='output'></output>\n" + + " </form>\n" + + + " <script>\n" + + " function x(id) {\n" + + " var e = document.getElementById(id);\n" + + " var disp = e.currentStyle ? e.currentStyle.display : window.getComputedStyle(e, '').display;\n" + + " alert(disp);\n" + + " }\n" + + " </script>\n" + + " <script>\n" + + " x('nav');\n" + + " x('noscript');\n" + + + " x('object');\n" + + " x('ol');\n" + + " x('optgroup');\n" + + " x('option');\n" + + " x('output');\n" + + " </script>\n" + + "</body></html>"; + loadPageWithAlerts2(html); + } + + /** + * @throws Exception if an error occurs + */ + @Test @Alerts("table table-header-group table-row-group table-cell table-row table-cell block list-item") public void defaultDisplayValuesTable() throws Exception { final String html = "<!DOCTYPE HTML>\n<html><body>\n" |