Skip to content

Instantly share code, notes, and snippets.

@Mr-VIT

Mr-VIT/iv.md Secret

Last active March 4, 2019 19:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mr-VIT/06caef475ebdd5931ffb202c384dcf2f to your computer and use it in GitHub Desktop.
Save Mr-VIT/06caef475ebdd5931ffb202c384dcf2f to your computer and use it in GitHub Desktop.
IV bugs and suggestions // detach, simplify

IV bugs and suggestions

Bug #1 [IV in browser preview]

Wrong scheme in iframe/@src

If the scheme is missing, IV adds the scheme of the original site instead of the viewer.

Example

IF original http, viewer https => "This request has been blocked; the content must be served over HTTPS."

http://example.com/post/1 : <iframe src="//another.net/embed/2"> =[IV]=> <iframe src="**http**://another.net/embed/2">

Suggestions

Suggestion #1 Improve function @detach

2 optional arguments @detach([unwrap : Boolean = false, [position : String = "before"]])

Examples Source:

<root>
	<p class="mixed">
		some <b>text</b>
		<img/>
		another <a>text</a>
	</p>
</root>

#1 after source: @detach(true, "after"): //p/img

<root>
	<p class="mixed">
		some <b>text</b>
		another <a>text</a>
	</p>
	<img/>
</root>

#2 after source: @detach(true, "inline"): //p/img

<root>
	<p class="mixed">
		some <b>text</b>
	</p>
	<img/>
	<p class="mixed">
		another <a>text</a>
	</p>
</root>

Suggestion #2 Improve function @simplify

1 optional argument @simplify([ignoreErrors : boolean = false])

<root>
	<div><p> </p></div>
	<div><p>some</p></div>
	<p>
		<img/>
	</p>
	<div><b>bold</b></div>
</root>

@simplify(true): /root

<root>
	<p>some</p>
	<p> <!-- ignored -->
		<img>
	</p>
	<p><strong>bold</strong></p>
</root>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment