Adam Haile
Adam Haile

Reputation: 31349

Determine where an element comes from

I've got a website that I'm maintaining (i.e. I didn't write it initially) and on one page there is an element that is nowhere in code and I cannot figure out where it is coming from. I would've assumed some javascript is inserting it but I have searched all the linked scripts and cannot find one that would be doing what I'm seeing. Basically it should look like this:

<li>
    <a href="example.com/products">Products</a>
</li>

but instead, shows up as this:

<li>
    <a href="example.com"></a>
    <a href="example.com/products">Products</a>
</li>

It's that top, empty tag that I have no idea where it's coming from.

In Chrome (or another browser) is it possible to get it to tell me what specifically is making that modification to the DOM, so that I can remove it?

Update: Page in question is https://app.alienskin.com/store/ It's inserting another link directly above the "products" link in the main nav menu. If you view source on the page, you can see that it is not there in source.

I tried disabling javascript and it still shows up in the rendered page... wtf?

Upvotes: 2

Views: 1154

Answers (2)

Nick Andriopoulos
Nick Andriopoulos

Reputation: 10643

I assume that you are using the Developer tools, and seeing that output. Use "view source" instead.

The explanation is that all browsers try to correct faulty HTML, and the developer tools show the code AFTER it has been altered by the engine to a "best effort correction" state. Your problem cause is most likely a mismatched tag (double and triple check spelling / quotes / etc or provide a link)

Edit: Found it -- inside your +++++ LOGO ++++ comment, there is a self-closing <a> tag :

<a href="http://www.alienskin.com" />

you either need to remove it (does nothing) or change it to "proper" syntax :

<a href="http://www.alienskin.com" ></a>

to comply with your doctype.

Upvotes: 3

julienc
julienc

Reputation: 20325

If you suppose it is Javascript, you can still disable it to be sure. To do this, press F12 on Chrome, then click on the wheel on the bottom right corner and check "disable Javascript". Then refresh your page.

If it is not the case, it will be hard to tell without the code...

Upvotes: 1

Related Questions