On 04/29/2010 07:28 PM, Denis Gervalle wrote:
On Thu, Apr 29, 2010 at 17:52, Sergiu Dumitriu<[email protected]> wrote:
On 04/29/2010 05:21 PM, dgervalle (SVN) wrote:
Author: dgervalle Date: 2010-04-29 17:21:25 +0200 (Thu, 29 Apr 2010) New Revision: 28664
Modified:
platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/table/livetable.js
Log: XWIKI-5135 - Highlight applied filters in livetable Fix tag names comparison to uppercase string.
Modified: platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/table/livetable.js =================================================================== --- platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/table/livetable.js 2010-04-29 13:13:38 UTC (rev 28663) +++ platform/web/trunk/standard/src/main/webapp/resources/js/xwiki/table/livetable.js 2010-04-29 15:21:25 UTC (rev 28664) @@ -698,7 +698,7 @@ * Apply style to livetable filters that are applied */ applyActiveFilterStyle: function(element) { - if(element&& ((element.tagName == "input"&& element.type == "text") || element.tagName == "select")) { + if(element&& ((element.tagName == "INPUT"&& element.type == "text") || element.tagName == "SELECT")) {
That's not quite correct. Depending on the browser, doctype and mimetype, it could be lowercase. Better use some case insensitive comparison, for example: element.tagName.toLowerCase() == "input"
I have hesitated, spec saying that HTML should be uppercased, and XML case sensitive, I have conclude that XHTML should have been uppercased, but I may be wrong. You see to better know that so, I will do so.
XHTML should be lowercase, since it's XML. But the problem is that we're sending documents as text/html, which triggers the HTML behavior, thus uppercased tagnames. But I've been thinking for a while about switching to application/xhtml+xml for the browsers that understand it (easy to detect based on the Accept request header), so it's better to make this code safe for the future.
Denis
if ($F(element) != '') { element.addClassName('xwiki-livetable-filter-active'); } else {
-- Sergiu Dumitriu http://purl.org/net/sergiu/