Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579609
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:55:12+00:00 2026-05-25T15:55:12+00:00

Working example: http://jsfiddle.net/JVVcA/ HTML: <fieldset id=data-page> <legend>data-page</legend> <button rel=page1>Highlight page one</button> <button rel=page2>Highlight page

  • 0

Working example: http://jsfiddle.net/JVVcA/

HTML:

<fieldset id="data-page">
    <legend>data-page</legend>
    <button rel="page1">Highlight page one</button>
    <button rel="page2">Highlight page two</button>
    <div data-page="page1">
        <h1 id="page1">Page one</h1>
        <h1 id="page2">Page two</h1>
    </div>
</fieldset>

<fieldset id="class">
    <legend>class</legend>
    <button rel="page3">Highlight page three</button>
    <button rel="page4">Highlight page four</button>
    <div class="page3">
        <h1 id="page3">Page three</h1>
        <h1 id="page4">Page four</h1>
    </div>
</fieldset>

CSS:

fieldset { border: 1px solid #aaa; padding: 5px; }

h1 { background-color: white; }
div[data-page="page1"] h1#page1 { background-color: pink; }
div[data-page="page2"] h1#page2 { background-color: pink; }
div.page3 h1#page3 { background-color: cyan; }
div.page4 h1#page4 { background-color: cyan; }

JS:

$('#data-page button').click(function(){
    var rel = $(this).attr('rel');
    $(this).siblings("div").attr('data-page', rel);
});

$('#class button').click(function(){
    var rel = $(this).attr('rel');
    $(this).siblings("div").attr('class', rel);
});

Initial load:

After clicking “Highlight page two” and “Highlight page four” in Webkit (specifically, Google Chrome stable Windows 7):

After doing the same in Firefox:

As you can see, the data-page selector works fine on the initial rendering of the of the page, but when the DOM is manipulated on the fly, styles defined by the [data-page="???"] CSS selector are not affected accordingly. Compare this to the situation with the class selectors. When classes are changed on the fly, the styles change as expected.

A possibly related note is that I’ve encountered cases while using this attribute selector in conjunction with CSS transitions where a similar lack of responsiveness happens, but on those cases, clicking elsewhere on the page, waving your mouse around, or just waiting for a bit eventually results in the expected change going through.

So is there a way around this other than to just throw up your hands and not use data-page-style attributes?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:55:13+00:00Added an answer on May 25, 2026 at 3:55 pm

    It’s the same issue that’s applied for the ~ or multiple + selectors and pseudo-classes in webkit: this kind of selectors are rendered only once and the last time I checked the relevant bug reports in webkit’s tracker, they stated that it works like intended.

    But, some people had found the fix, but it’s really is overhead: to add always-reflowing property to body, so it’s must be added only to those elements, where something changes, the divs inside field sets for your example.

    So, there is a fixed fiddle: http://jsfiddle.net/JVVcA/2/

    And these are the styles for fixing such problems:

    /* The `fixing` animation */
    @-webkit-keyframes bugfix { from { padding: 0; } to { padding: 0; } }
    .anElementToFix { -webkit-animation: bugfix infinite 1s; }
    

    Note that you must add the fix to the element whose attribute is can be changed, not the targeted by selector elements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have a problem with the revert speed. Here is a working example http://www.jsfiddle.net/V9Euk/94/
Here's my non-working example to demonstrate the kind of thing i'm looking for. http://jsfiddle.net/h2cQ6/2/
Here is a working example: http://jsfiddle.net/FzZwt/8/ If I pass false to the toggle() first
See working example at http://jsfiddle.net/xqwqH . I have a green div inside a red
Working example: http://alpha.jsfiddle.net/gTpWv/ Both of the methods work separately, but once regexp for smilies
im following this example http://jsfiddle.net/rniemeyer/badZb/ . I just copy and paste the exact code
UPDATE 2 - RESOLVED: Got it working: http://jsfiddle.net/7CvZ9/12/ Had to add some classes. UPDATE
Consider the following example (also available here: http://jsfiddle.net/hq8Fg/1/ ). It works fine in IE9,
I have a dropdown menú you can see in the next example: http://jsfiddle.net/WYMzX/1/ If
Does anyone has the code to a full working example of slartoolkit ( http://slartoolkit.codeplex.com/

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.