Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JQuery and frame(set)s - why do they disappear?

When I use the console and I try to create an element with tag frameset, I get no result:

$('<div id="content" data-something="hello" />')
=> [<div id=​"content" data-something=​"hello">​</div>​]
$('<frameset frameborder="0" framespacing="0" marginwidth="0" marginheight="0" framespacing="0" border="0"></frameset>')
=> []

This behaviour persists across multiple JQuery versions (like 1.10.2, 2.0.0 and 1.2.6 etc.)

How can I read the 'frameborder' (for example) attribute from this frameset without having to build a parser by mself?

P.S. (If you wonder why I use frames) This line (or a line like this) is a response from an external (more or less) API that I cannot change. I would just like to read the information and go on.

like image 876
Danyel Avatar asked Mar 21 '26 01:03

Danyel


1 Answers

The frameset tag is to be used as the body of framed documents in place of the body tag, and in conjuction with the frameset document type declaration. It is considered obsolete since HTML5.


To solve your issue, your best bet is to parse the portions you require from the string on your own or use an HTML parsing library such as htmlparser.js

like image 134
Ben Barkay Avatar answered Mar 23 '26 14:03

Ben Barkay