Skip to content

Instantly share code, notes, and snippets.

@AliciaSchep
Created April 12, 2018 05:01
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 AliciaSchep/ea472176ae9a75237be6a863af14f942 to your computer and use it in GitHub Desktop.
Save AliciaSchep/ea472176ae9a75237be6a863af14f942 to your computer and use it in GitHub Desktop.
Example document showcasing a bug with inappropriate insertion of wheel event listener by rstudio in rmarkdown inline view / notebook
---
title: "event listener bug"
author: "Alicia Schep"
date: "April 11, 2018"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Example of inappropriate wheel event listener insertion by rstudio in rmarkdown inline view
```{r}
library(htmltools)
```
```{r}
download.file("https://cdn.jsdelivr.net/npm/vega-embed@3.1.1/build/vega-embed.js",
"vega-embed.js")
```
```{r}
ve_dep <- htmlDependency("vega-embed", "3.1.1",
src = getwd(),
script = "vega-embed.js")
```
If you look at the console, there is an error "SyntaxError: Expected an identifier but found 'text' instead". When you look at the line of code that generates that error, it appears that the wheel event listener has been inserted into the vega-embed.js source.
```{r}
tagList(ve_dep,tags$h3("check console"))
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment