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

  • SEARCH
  • Home
  • 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 9185715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:20:40+00:00 2026-06-17T19:20:40+00:00

i have a userjs script for opera which displays its own interface, currently using

  • 0

i have a userjs script for opera which displays its own interface, currently using DOM methods to create elements. This works well, but is hard to maintain as the interface is tied to the code. So I’m looking for a way to separate layout from code. Also i want to keep things simple and really don’t want to rely on a framework (jquery…) for that. I don’t care about cross-browser functionality, this thing can only work on opera anyway.

i got all the style stuff into css, that helped. Now i’m looking for a way to abstract the layout. A good part of the UI is quite dynamic, so I can’t just use one big static html. The idea that came up was to have a piece of html containing the layout for the different UI parts, extract fragments from that and put everything together as needed.

This works pretty well to some degree:

  • create a div, never parent it.
  • use .innerHTML to load the html into it
  • use this getElementsByClassName() to find widgets in it
  • clone them with widget.cloneNode(true)
  • parent it etc…

I know of some issues with cloneNode() (risk of duplicate ids, and event handlers missing in the clone) but i can work around them.

The problem is, with .innerHTML loading i get different results from the current DOM code, even though i use a captured layout from the DOM code version ! I’m seeing this with tables for example. For a simple

<table><tr><td></td></tr></table>

the innerHTML version shows up with <tbody> tags in it in dragonfly, and css rules like this one don’t apply anymore because of it:

table > tr > td { ... }

I have a baaaad feeling about all this …

  • Are there other big differences between DOM and html layouts ?
  • Maybe i should really be using <tbody> in the DOM stuff ?
  • How would you do this ?

Bonus question:

  • what is the reason behind createDocumentFragment() existence ? what can you do with it that can’t be done otherwise ?
  • 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-06-17T19:20:42+00:00Added an answer on June 17, 2026 at 7:20 pm

    You’re right, it looks like a table whose markup doesn’t define <tbody>, will be converted to markup with the <tbody> tag present when reading the innerHTML poperty of a table.

    But this shouldn’t cause too much trouble for you: as for the CSS issue, drop the > from your selectors (restricts to direct descendent).

    One possible benefit of DocumentFragment is that when you need to do significant amount of DOM manipulation, it may cause some performance gain if only a document fragment is manipulated and once all transformations are done, it is attached to the DOM.

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

Sidebar

Related Questions

We have a script right now which our Windows users run on a Linux
I have a script which loops through a list of users (samaccountname): # Read
I have found a script that adds mouse trail on Opera's mouse gesture. Very
I have to code some kind of (perl) script which queries a Facebook wall
In my application users have their own websites which can be reached if they
I have developed an extension for opera which lets users to Google +1 websites.
:-) I have this script, which find a users position taken from the number
Using SQL Server 2008 R2, I have a Users table, in which I would
I have a strange problem here. I am using a directory script running off
I have a 500,000 line SQL script: UPDATE users SET region_id = 9814746 WHERE

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.