Questions tagged [stack-snippets]
Stack Snippets are runnable code sandboxes of the front-end languages HTML, CSS, and JS for use within a Stack Exchange post. Use this tag for bug reports, feature requests, and discussions explicitly relevant to these snippets and their underlying technologies.
473
questions
46
votes
0
answers
738
views
Don't push my tab's history too far
Whenever I click on Stack-Snippets®'s in any post, a new entry is made in my tab's history (the one for the back and forward buttons, accessible through window.history in js).
I like to keep my tab's ...
3
votes
0
answers
98
views
Code snippets with personal templates
I'll start with the question: Is there a way to create a template for the stack-snippets?
I often find my self "building" a working code example with some boilerplate code just to demonstrate simple ...
6
votes
1
answer
314
views
Set code snippet result window height
When you have code that generates a higher "box" than the result window, it's hard to see the content of it.
Is there a way to control the height of the result window?
I'm aware of the full screen ...
2
votes
1
answer
152
views
JW Player doesn't load on Stack Snippets but it does on Plunker
After posting a demo using JW Player, I get this error:
"message": "Uncaught ReferenceError: jwplayer is not defined",
"filename": "https://stacksnippets.net/js",
"lineno": 25,
"colno": 15
Yet ...
-5
votes
1
answer
1k
views
"Uncaught ReferenceError: func is not defined" [closed]
I am answering a question on Stack Overflow and added some simple JavaScript code. I define a function, call the function once, and then setup an event listener on a button to also call the ...
3
votes
1
answer
370
views
Stack Overflow code snippets vs JSFiddle [closed]
Few minutes back I tried to answer a question on Stack Overflow related to javascript
So jumped to test the code first and fixed the stuff in stack code snippets and however it shows a console ...
3
votes
0
answers
32
views
Where should I link new users for guidance on using Stack Snippets? [duplicate]
I frequently see new users turn up whose JavaScript example could quite easily be made an MCVE by making it a Stack Snippet. Rather than risk confusing them by editing it in, it might be best to link ...
5
votes
0
answers
172
views
Does Stack Overflow have plans to make runnable code snippets for the Android app?
The Stack snippets is the best way to demonstrate problem in question post and provide runnable solution in an answer. But this tools doesn't work in the Official Stack Overflow application for ...
16
votes
2
answers
228
views
Stack Snippet buttons are 100% wide
I've just noticed, in the last couple minutes, the Stack Snippet buttons are 100% wide, as you can see the in Screenshots below:
Screenshot #1
Screenshot #2
I found the class culprit for the issue, ...
3
votes
0
answers
80
views
Bug in code snippet in revision page
When checking answer edit history in Stack Overflow, the changes in the code snippet are displayed correctly, but on pressing "Run Code Snippet" The first line was not being recognized by the snippet ...
4
votes
1
answer
412
views
Sharing data between snippets, such as test inputs
Sometimes I write multiple snippets in an answer, to show different approaches. Often, they use the same test data, which sometimes can be big.
I'd like the ability to somehow designate a snippet as ...
1
vote
0
answers
70
views
CSS [attribute*=value] selector not working [duplicate]
In answering a question on SO I tried to insert some basic CSS. The CSS renders correctly on Codepen but on SO it appears the [attribute*=value] selector does not work.
The example below should ...
3
votes
0
answers
72
views
Code snippet breaks Markdown parser
When editing a post, the Markdown parser in the Preview seems to break down after a code snippet. Everything (except the pre-formatted text) following the code snippet in Example A below appears ...
2
votes
0
answers
65
views
API - Undocumented? - Hide part of the snippet (not all of it) [duplicate]
I'm looking at the code inside snippet-javascript....js files, I can see I can hide as in the UI checkbox the snippet, sending hide var. but what I want is (if possible) to select to hide for example ...
36
votes
0
answers
486
views
Close Snippet obstructed in Full Screen
Alter the z-index of fixed top bar when using Full Screen Snippets has been fixed. But click on the full screen preview and try to close the snippet?
Hello! Click on the full page above right and ...
7
votes
0
answers
147
views
Alter the z-index of fixed top bar when using Full Screen Snippets [duplicate]
We need to hide the fixed header for Stack Overflow or send it back when the full screen snippet comes up. Use case, try full screen snippet on this and try to read it:
Hello! Read this in Full ...
7
votes
0
answers
97
views
Sticky Navigation Blocks Full Page Stack Snippets [duplicate]
If you're using the sticky navigation option that pins the navigation to the top of the screen and try to run a stack snippet in full screen mode, it cuts off the rendered code:
Since the navigation ...
15
votes
1
answer
939
views
How to edit a snippet once inserted in the Stack Overflow answer?
I am having a very simple problem, that is, when I insert a snippet for an answer then how do I again open it in the editor and edit it?
Whenever I click the snippet button to edit, then I get ...
7
votes
0
answers
167
views
Correct Line Numbers for error messages in snippets
I try to write a working snippet in as many answers as possible. I find one of the hardest parts is tracking down bugs because the console messages show line numbers that don't match the snippet ...
55
votes
1
answer
844
views
Snippet insertion corrupts content
To reproduce
Replace indented code with snippet in a question which has more explanation after the code
Expected result
Snippet replaces code
Actual result (in latest Chrome at least)
Snippet ...
3
votes
0
answers
67
views
How to add querystring parameters to JavaScript snippets
I'm trying to answer a question that requires manipulating the querystring parameters of a given page. I wanted to use the snippet editor on Stack Overflow to give an example, but the page that ...
2
votes
0
answers
93
views
Whitespace in stack snippets removed
I was just answering a question asking about allowed whitespace in JavaScript code and included example code. This code snippet includes spaces, form-feeds (U+000C), line-tabulations (U+000B).
...
3
votes
0
answers
54
views
Stack snippet sub domain and Ajax cors
Do stack snippets have a subdomain? What is it?
Is there a list of images or icons from that subdomain which I can use in Ajax requests to load images for use in stack snippets?
21
votes
1
answer
316
views
Sticky top bar obscures full screen code snippets
The top menu bar, when set to sticky, hides content when one run a snippet in full screen.
Is there some new setting to control this that I might have missed?, or someone else missed something :)
...
3
votes
0
answers
51
views
"Use BabelJS / ES2015" on Code Snippet - tooltips needs to be with container "body"
If you create a code snippet, for ex. here in meta. If you hover over the "Use BabelJS / ES2015" right (i) icon, or the "Hide snippet by default" (i) icon. It shows a tooltip, but it seems the ...
9
votes
1
answer
259
views
Is it possible to search for stack snippets?
I want to find all stack snippets for a given language/technology.
Is there a way to query for this?
2
votes
0
answers
39
views
Is it acceptable to edit out "stack snippet" formatting that has no benefit over `code formatting`? [duplicate]
This answer is a bit cluttered by the code snippet formatting and offers no value. I want to revert it to traditional grey code formatting with no buttons.
Question
Are there guidelines on how to ...
-9
votes
1
answer
151
views
Feature request: Adding a Stack snippet can automatically detect what code is in the question already?
For context I see a lot of new users who fail to realize there is a runnable inline code snippet feature that lets them have a running example.
Now unfortunately I don't know if there is a better way ...
3
votes
0
answers
101
views
I can't insert snippets on Chrome, Ubuntu, as of today (8 may `17)
I read existing questions on errors for inserting code snippet in answers but they were all duplicated to this question which states the issue is fixed. Besides, I wasn't able to find another question ...
13
votes
2
answers
545
views
Flag comments suggesting a jsfiddle or jsbin fiddles over stack-snippets
A new user just posted their very first question on SO, the question is great - Clear description of the issue, and a working stack-snippet as a MCVE that you can copy to you answer and post a ...
34
votes
1
answer
700
views
Guideline on edits that only add/remove stack snippet
I am a new approver for the Suggested Edits review queue.
After going through several of them yesterday; I found that 3 to 4 of them were just suggestions either to add or remove Stack Snippets from ...
17
votes
1
answer
484
views
Multiple text cursors in stack snippets?
Today I noticed that Stack Snippets support multiple text cursors. Holding Ctrl and clicking into a new line places a secondary cursor (at least in FF 53.0):
Screenshot:
While this might be a hidden ...
2
votes
1
answer
71
views
Possible bug in snippets
In my answer here the return of document.getElementsByTagName() is incorrect.
As far as I can tell, this is caused by the way the window.onload() is being dealt with.
Minimal reproduction of issue:
...
0
votes
0
answers
41
views
Snippet showing double results [duplicate]
I'm facing a strange behavior with Stack Overflow's snippet option. Whenever I edit any post, and save a snippet, suddenly other posts' snippet are showing double results.
I don't know if this ...
14
votes
2
answers
439
views
Is it legitimate to reference an (unlisted) external scripted library or framework in a stack snippet?
In StackSnippets, the dropdown options (for jQuery, AngularJS etc.) are not available for most third-party scripted libraries or frameworks.
UPDATE: Ah. It turns out there is a button for third-...
1
vote
0
answers
37
views
Stack snippets are parsed within code blocks [duplicate]
Today I stumbled across this post, where the placement of the stack snippet buttons irritated me.
Long story short, the begin snippet and end snippet comments seem to get parsed everywhere.
This ...
18
votes
1
answer
284
views
Keyboard lag when editing answers with stack snippets
When answering JavaScript questions, I often include a handful of code snippets to accompany written descriptions. I've noticed that after two or three snippets, when I'm continuing to write the ...
12
votes
0
answers
183
views
Doubled stack snippet buttons
Sometimes after I post a comment or edit the question or answer, the buttons below the stack snippets in the question get duplicated.
I haven't been able to reproduce this reliably, but I first ...
2
votes
0
answers
82
views
SO Stack snippet console displays <input></input> is this a bug?
Is there a reason why the Stack snippet console displays <input> elements within an array with an end tag? I noticed this behavior when posting this answer.
Both Chrome and Firefox consoles on ...
3
votes
1
answer
69
views
Please add the latest Knockout version (3.4.2)
In supporting Knockout questions, I noticed that the snippets only includes up to version 3.2.0 and now we're up to 3.4.2.
7
votes
0
answers
59
views
Stack snippet indentation - preview differs from result
Today I encountered a code snippet whose preview renders fine during editing but with unwanted indentation after submitting:
arr1 = [{
Title: "xXx: Return of Xander Cage",
...
1
vote
2
answers
99
views
Is it bad to introduce snippet formatting?
I recently submitted an edit to a new user's html/js post changing their code block to a Stack Snippet. My edit was rejected with the non-critical message. Should it have been accepted, or is it bad ...
13
votes
1
answer
1k
views
Why are we disallowed to use HTML5 local storage on code snippets?
I attempted to post the following code snippet using HTML5 local storage, but I receive:
Submit { "message": "Uncaught SecurityError: Failed to read the
'localStorage' property from 'Window': ...
1
vote
2
answers
201
views
"Edit the above snippet" is very small on Ask Question page in Edge
The visual appearance of Edit the above snippet is very small in Edge.
In Chrome
It is perfect.
But
In Edge
More Details
Edge
"Mozilla/5.0 (Windows NT 10.0; Win64; x64; ServiceUI 8) AppleWebKit/...
8
votes
0
answers
90
views
In the revision view the code snippet runs old code
In case someone posts a bad snippet and he or someone else fixes the code, the snippet runner in the revision view will play the old code.
Basically it will run the red and stroked code anyway. This ...
7
votes
1
answer
175
views
Why is form submit disabled in stack snippets?
Some questions require an answer with a submit in it.
As I explain in https://meta.stackoverflow.com/a/339535/295783,
I daily run into not being able to post a snippet in an answer that has a form ...
2
votes
1
answer
81
views
Stack snippet Auto indentation not work anymore
I just noticed that the Auto indentation (Shift + tab) does not indent the code anymore in the stack snippet but instead reduce the indent level by one, example to make a fast test :
<ul>
&...
2
votes
0
answers
82
views
Stack Snippet won't work with Firebase
There was an answer for a question about Firebase here: https://stackoverflow.com/a/42137694/9903
initially the code was on codepen: http://codepen.io/elrumordelaluz/pen/...
2
votes
0
answers
50
views
Stack snippets not working [duplicate]
I'm sure you've seen it though the Stack snippets render Service Unavailable
Also, is this the proper place to post an issue like this?
Here is my tracert if it can help
Tracing route to ...
10
votes
0
answers
194
views
Stack Snippets Returning a 503 Service Unavailable Error
Not sure if it's just me but Stack Snippets seems to be down
E.g. http://stacksnippets.net/
Hi