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 8003571
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T16:40:57+00:00 2026-06-04T16:40:57+00:00

In my userscript i created a hook of document.createElement the code i used is

  • 0

In my userscript i created a hook of document.createElement the code i used is the solution provided by Brock adams in the below post

Log a web page's dynamically-created, DOM elements with a userscript

Now when i run this userscript in firefox and print the elem in LogNewTagCreations () method like this console.log(elem) i am getting the output as [object XrayWrapper [object HTMLDivElement]] in this format. Now how can i get the innerHTML property of the tag or entire tag like this <div>Sometext</div> so that i can get innerHTML from this

  • 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-04T16:40:59+00:00Added an answer on June 4, 2026 at 4:40 pm

    It would appear that the XrayWrapper used by Greasemonkey to wrap around DOM elements is quite an imperfect wrapper, since it doesn’t really support the innerHTML getter/setter.

    I wrote you a simplistic recursive innerHTML implementation, call it like this: html(element). It ignores everything but elements, attributes and text nodes, but it should serve its purpose as long as the XrayWrapper supports the other DOM attributes I use in the function.

    var html = (function() {
      var ELEMENT = this.Node?Node.ELEMENT_NODE:1,
             TEXT = this.Node?Node.TEXT_NODE:   3;
      return function html(el, outer) {
        var i = 0, j = el.childNodes, k = outer?"<" + (m = el.nodeName.toLowerCase()) + attr(el) + ">":"",
            l = j.length, m, n;
        while(i !== l) switch((n = j[i++]).nodeType) {
          case ELEMENT: k += html(n, true); break;
          case TEXT:    k += n.nodeValue;
        } return k + (outer?"</" + m + ">":"");
      }; function attr(el) {
        var i = 0, j = el.attributes, k = new Array(l = j.length), l, m;
        while(i !== l) k[i] = (m = j[i++].nodeName) + "=\"" + el.getAttribute(m) + "\"";
        return (l?" ":"") + k.join(" ");
      }
    })();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

As per this post Log a web page's dynamically-created tag attributes with a userscript
I am able to track all the dynamically created tags, using Brock Adams' answer
I've a userscript as the following: document.addEventListener('click', alert('hello monkey'), true); There were two problems:
I'm trying to create a userscript that automatically adds a QR code image of
Here is some example code: frames = document.getElementsByTagName('iframe'); parent = frames[0].parentNode; parent.removeChild(frames[0]); Works in
This code is from Facebook Chat Emoticons Bar Grease Monkey UserScript ImagesURL = HttpsOn?'https://s-static.ak.fbcdn.net/images/':'http://static.ak.fbcdn.net/images/';
I have a Greasemonkey userscript which runs most of its code in an unprivileged
I'm writing a userscript for a page which has this HTML code block.. <span
I'm trying to create a userstyle (installed in Google Chrome as a userscript). It's
I wrote a userscript to highlight the current row in GMail (indicated by the

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.