Re: counter-increment is not available from element.currentStyle inIE
Rob,
I would really love to post the issue myself, but I simply am not able
to. I created an account on connect.microsoft.com and joined the IE
feedback program, however there is no way to submit an issue that I
can see. I may be simply missing something, but I can only view
current issues, not submit them. On my dashboard, when I select the
Internet Explorer Beta Feedback connection, the only action under the
action menu is "See more actions on homepage", which takes me to the
page which says that I may only post to this list and have someone
else submit the bug for me. I realize this is not the forum for
problems with the connection website, so I have filed a support ticket
with the connection site in the hopes of being allowed to submit an
issue.
Here I will attempt to restate the issue, addressing your concerns.
The issue is with the IE JavaScript implementation. The
element.currentStyle property does not behave how the Microsoft
documentation claims that it should behave in this case. According to
MSDN, counter-increment should be available as a read-only property of
currentStyle
(
http://msdn.microsoft.com/en-us/library/cc196963(VS.85).aspx) in
IE8. As you found in other documentation, this property will only
work if a !DOCTYPE is declared on the page and is viewed in standards
mode. The property (counter-increment) is properly applied to counter
CSS property, which it modifies. However, its value is not made
available through the currentStyle property of the elements which its
selector matches.
My initial test does not have any of the problems that you have with
my latest, pure JavaScript test case. My initial test case was valid
HTML 4, validated by the W3C website.
http://validator.w3.org/check?uri=http://seanmk.com/counter-increment.html
It contained no DOM injection, had a !DOCTYPE and was completely
sandboxed. The JavaScript is necessary to demonstrate the problem
because the problem I am reporting is with the Internet Explorer
JavaScript engine. These selectors, CSS, HTML and JavaScript are
completely valid, and remarkably similar to the first counter-
increment test page in the IE test center at
http://samples.msdn.microsoft.com/i...s/counter-increment/counter-increment-001.htm
Because the problem is with the currentStyle property, which is
JavaScript, it is not helpful for this test case to change the class
that is applied to the element. The class is being correctly applied
to the element, but the value of the counter-increment style is not
available through the matched elements' currentStyle property.
To further demonstrate this, I have copied and slightly modified the
test page from the IE test center that I pointed to above. This is
available at
http://seanmk.com/counter-increment-001.htm
and its validation results are at
http://validator.w3.org/check?uri=h...(detect+automatically)&doctype=Inline&group=0
As you can see, the counter-increment property is being properly
applied to the div tag. This is apparent because the assertion from
the original test page is true in IE8: a 1 does appear. However, the
assertion from my modified page is not true in IE8: an alert box does
not appear with the text "ident". Instead, it appears with the text
"undefined".
Because my test page is completely isolated, is using almost exactly
the same markup and CSS as the original Microsoft test case and I can
cite documentation that contradicts the behavior that is shown in the
test case, I believe that this is grounds for a bug to be opened and
should not be dismissed. The complexity of the test case is necessary
because the behavior in question in somewhat complex. Additionally, I
have provided 2 other methods to demonstrate the same behavior using
somewhat different code. I am trying very hard to be helpful here. I
am not trying to cause any difficulties, I am just trying to help
alert the Internet Explorer team to a problem that they will probably
want to know about.
Please advise,
Sean
On Jan 26, 3:08 pm, "rob
" <iecustomi...@hotmail.com> wrote:
> Hi Sean,
> <quote>
> If you have an issue with the IE8 beta that is not reported, we> encourage you to visit the IE Beta Newsgroup. Members of the Technical
> > Beta program can verify and submit bugs on your behalf.
>
> </quote>
>
> Yes that is correct. We can raise an issue ticket on your behalf. But what
> issue are you testing? IE's javascript implementation, IE's DOM
> implementation or IE's w3c standards implementation.
>
> You should also be able to join connect on your own behalf and then join the
> IE feedback program and then raise issue tickets on your own behalf. I don't
> want to get involved in a bar fight with you over your test case. I see
> immediate errors and design patterns in your sample that I know the IE
> testers at connect will reject out of hand. Unfortunately I am not in a
> position to verify your test case as it is missing certain criteria and no.1
> does not validate because you are using DOM injection with javascript.
> Someone else here with connect access may like to post it on your behalf,
> but I personally think your test case has more work to be done on it not to
> be rejected out of hand further up the triage process at connect.
>
> As the w3c sample already points out, counter support only occurs in IE8
> Standards mode (viz you page needs a valid DTD).
>
> Your test function will fail under certain circumstances. Where are you
> placing the script block. In the Head or body blocks?
>
> The IE test center can be viewed athttp/samples.msdn.microsoft.com/ietestcenter/
>
> CSS 2.1 test cases -http/samples.msdn.microsoft.com/ietestcenter/css.htm
> (use the Find on Page tool to search for the selector keyword to find
> existing test cases for selectors compliance)
>
> From the test cases on those pages you will see the general methodology that
> is used to create the cases. Basically they are Unit tests. All test cases
> include a valid DTD declaration. All are sandboxed (do not include links to
> external resources) and are crafted to be browser independant.
>
> I would suggest that you craft your test case and replace the DOM injection
> with vanilla(validated) html.
> Then replace the javascript rule manipulation with a style block with two
> different classes and a small script block that toggles the class value of
> the element to test the style rule implementation.
>
> By removing all the javascript and DOM injection code you can then use the
> markup and style validators on the IE Developer tool to correct any errors.
> Is the selectors rules valid for a <div> element?
>
> Regards.
>
> "Sean Kauffman" <sea...@gmail.com> wrote in message
>
> news:f3a71248-39b8-407a-b5af-874d19376646@c34g2000yqn.googlegroups.com...
>
>
>
> > Hi Rob,
> > Thanks very much for your feedback. I also would like to avoid any
> > kind of bad feelings. Here I have further isolated the test case and
> > reduced it to only JavaScript. In IE6 and IE7 this will "test" while
> > IE8 will alert "undefined". This will not work in any browser but IE
> > as it utilizes proprietary IE API's.
>
> > function test() {
> > var div = document.createElement('div');
> > document.body.appendChild(div);
>
> > var style = document.createStyleSheet();
> > style.addRule("div", "counter-increment:test", -1);
>
> > var result = div.currentStyle["counter-increment"];
> > alert(result);
> > }
>
> > I probably missed something, but I posted to this group because I
> > could not find a way to post a bug on the connect.microsoft.com site.
> > The page athttp/connect.microsoft.com/IEsays this:
>
> > • If you have an issue with the IE8 beta that is not reported, we
> > encourage you to visit the IE Beta Newsgroup. Members of the Technical
> > Beta program can verify and submit bugs on your behalf.
>
> > When I searched for the IE8 beta Newsgroup the only group I could find
> > that seemed appropriate was this one. If you could help point me to a
> > more appropriate newsgroup to take this issue to, or a link the
> > specific page where I could submit a bug, that would be most
> > appreciated.
>
> > Thanks again and sorry for the less clear example before.
> > Sean
>
> > On Jan 23, 12:24 pm, "rob" <iecustomi...@hotmail.com> wrote:
> >> Hi Sean,
>
> >> You can submit your IE8 feedback at connect.microsoft.com (You need a
> >> Live
> >> ID/Passport to join)
> >> We are volunteers here and all IE8 issue tracking is done at the MS
> >> feedback
> >> site by full time MS employees.
>
> >> I am not going to get into a bar fight with you over your test case, I
> >> would
> >> just suggest that you consider
>
> >> Your test case should be simple and exemplify the issue.
> >> I am not sure if the issue is DOM or CSS related. The w3schools sample I
> >> pointed to was an example test for selectors support.
>
> >> Your submission will have more importance if it is using a common design
> >> pattern. You are using a mix of markup, css rules, javascript and DOM
> >> manipulation in your test case. The w3schools sample shows a common
> >> design
> >> pattern for its practical application.
>
> >> Your test pages do not work as expected in either IE (6-, FX or Chrome.
> >> (suggests something fundamentally wrong. Try the Tidy html validator when
> >> using FX)
>
> >> You can browse the connect IE8 issues and see if the issue has already
> >> been
> >> documented and also see how other test cases have been crafted.
>
> >> Regards.
>
> >> "Sean Kauffman" <sea...@gmail.com> wrote in message
>
> >>news:46511bf0-a191-4112-adf2-18dcbe829a2a@l19g2000yqb.googlegroups.com....
>
> >> > Rob,
> >> > Thanks for your answer, but this is not the problem. I am sorry that
> >> > I didn't copy the !DOCTYPE declaration into the page, but you will
> >> > find that my example code has the same results whether there is a !
> >> > DOCTYPE declared or not.
>
> >> > I'll repaste with the doctype included just to be clear. I shouldn't
> >> > have assumed that a !DOCTYPE was a given, sorry.
>
> >> > <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http/www.w3.org/
> >> > TR/html4/strict.dtd">
> >> > <html>
> >> > <head>
> >> > <title>Counter Increment Test Page</title>
> >> > <style type="text/css">
> >> > div { counter-increment:test; }
> >> > </style>
>
> >> > <script type="text/javascript">
> >> > function test() {
> >> > var nodes = document.getElementsByTagName("div"),
> >> > result = [],
> >> > length = nodes.length, i;
>
> >> > for(i = 0; i < length; ++i) {
> >> > result.push(nodes.currentStyle["counter-increment"]);
> >> > }
> >> > return result.join(', ');
> >> > }
> >> > </script>
> >> > </head>
> >> > <body onload="alert(test())">
> >> > <div> </div>
> >> > <div>foo</div>
> >> > <div><div>bar</div></div>
> >> > </body>
> >> > </html>
>
> >> > Additionally, as I am doing more research, I have found other strange
> >> > inconsistencies with the currentStyle property. I have not yet been
> >> > able to build a good example to demonstrate the problem, however.
>
> >> > Sean
>
> >> > On Jan 21, 11:22 pm, "rob" <iecustomi...@hotmail.com> wrote:
> >> >> Hi,
>
> >> >> You will see the answer on this test
> >> >> page -http/www.w3schools.com/CSS/tryit.asp?filename=trycss_gen_counter-reset
>
> >> >> Hint: DTD
>
> >> >> Regards.
>
> >> >> "Sean Kauffman" <Sean Kauff...@discussions.microsoft.com> wrote in
> >> >> messagenews:0E24958A-E976-4B27-B95A-B5BF5797BCD5@microsoft.com...
>
> >> >> > The CSS property counter-increment is not available through the
> >> >> > element.currentStyle property, although it is supposed to be.
> >> >> > According
> >> >> > to
> >> >> > MSDN, counter-increment is available as a read-only property of
> >> >> > currentStyle
> >> >> > (http://msdn.microsoft.com/en-us/library/cc196963(VS.85).aspx) in
> >> >> > IE8,
> >> >> > however this not the case.
>
> >> >> > The following HTML demonstrates this problem.
>
> >> >> > <html>
> >> >> > <head>
> >> >> > <title>Counter Increment Test Page</title>
> >> >> > <style type="text/css">
> >> >> > div { counter-increment:test; }
> >> >> > </style>
>
> >> >> > <script type="text/javascript">
> >> >> > function test() {
> >> >> > var nodes = document.getElementsByTagName("div"),
> >> >> > result = [],
> >> >> > length = nodes.length, i;
>
> >> >> > for(i = 0; i < length; ++i) {
> >> >> > result.push(nodes.currentStyle["counter-increment"]);
> >> >> > }
> >> >> > return result.join(', ');
> >> >> > }
> >> >> > </script>
> >> >> > </head>
> >> >> > <body onload="alert(test())">
> >> >> > <div> </div>
> >> >> > <div>foo</div>
> >> >> > <div><div>bar</div></div>
> >> >> > </body>
> >> >> > </html>
>
> >> >> > On page load, an alert box should appear with the string "test,
> >> >> > test,
> >> >> > test,
> >> >> > test", from the 4 counter-increment values read from their
> >> >> > currentStyle
> >> >> > properties. This works in IE6 and IE7, however it does not work in
> >> >> > IE8
> >> >> > even
> >> >> > in IE7 compatibility mode. Instead it displays the string ",,,"
> >> >> > because
> >> >> > the
> >> >> > property cannot be read. That this works in IE6 and IE7 has more to
> >> >> > do
> >> >> > with
> >> >> > those browsers' willingness to pass any CSS value through to
> >> >> > currentStyle,
> >> >> > since they do not support the counter-increment CSS property.
>
> >> >> > ----------------
> >> >> > This post is a suggestion for Microsoft, and Microsoft responds to
> >> >> > the
> >> >> > suggestions with the most votes. To vote for this suggestion, click
> >> >> > the
> >> >> > "I
> >> >> > Agree" button in the message pane. If you do not see the button,
> >> >> > follow
> >> >> > this
> >> >> > link to open the suggestion in the Microsoft Web-based Newsreader
> >> >> > and
> >> >> > then
> >> >> > click "I Agree" in the message pane.
>
> >> >> >http://www.microsoft.com/communities/newsgroups/list/en-us/default..as...