#StackBounty: #javascript #html #css #html2canvas How to take a screenshot of HTML Node with clip-path CSS property? (html2canvas not w…

Bounty: 100

I’m using html2canvas library to take a screenshot of a HTML Node, but it simply doesnt recognize the clip-path property.

(i’m getting cross-origin issue trying to replicate the error here, so i made a jsfiddle)

https://jsfiddle.net/1Ly9wn6k/

<div id="root">
  <div class="star-mask">
    <div class="square"></div>
  </div>
</div>

<button onclick="capture()">Capture</button>
.star-mask {
  clip-path: path('m55,237 74-228 74,228L9,96h240');  
}

.square {
  background-color: red;
  width: 200px;
  height: 150px
}

function capture() {
  let node = document.querySelector('.star-mask')


  html2canvas(node)
    .then(canvas => {
      document.querySelector('#root').appendChild(canvas)
    })
}

Every time i click on "Capture" the canvas screenshot completely ignores the clip-path of the star shape and display only the red square. I already tried html2image library and got the same issue.

There is some other solution that can solve this issue? Or is currently impossible to capture the clip-path property using JavaScript?


Get this bounty!!!

#StackBounty: #html #canvas #html5-video Capturing a sectioned image from a canvas with responsive layout

Bounty: 100

I have a canvas with various div elements serving as boxes that represent areas of the canvas to capture. When the capture takes place, it isn’t exactly as displayed on the screen. How can I track and responsively capture the div sections as they appear?

As an example, attempting to capture the large purple section:

enter image description here

enter image description here

Here is the code from the component:

<template>
  <div>
    <div class="video-wrapper">
      <canvas ref="the-canvas" class="canvas">
      </canvas>
      <video class="video" ref="video" autoplay />
      <div :class="profileCenter.name" :style="profileToStyle(profileCenter)" />
      <div :class="profileTopLeft.name" :style="profileToStyle(profileTopLeft)" />
      <div :class="profileTopMiddle.name" :style="profileToStyle(profileTopMiddle)" />
      <div :class="profileTopRight.name" :style="profileToStyle(profileTopRight)" />
    </div>
  </div>
</template>

<script lang="ts">
import { Vue, Component, Watch } from 'vue-property-decorator'
import Header from '@/components/Header.vue'

@Component({ components: { Header } })
export default class Test extends Vue {
  private userMedia: MediaStream | null = null
  private winHeight: number = window.innerHeight
  private winWidth: number = window.innerWidth

  private profileCenter: any = { name: 'profile-box', height: 350, width: 250, top: 40, left: 50, transform: [-50, -50] }
  private profileTopLeft: any = { name: 'profile-box', height: 100, width: 100, top: 20, left: 20, transform: [-50, -50] }
  private profileTopMiddle: any = { name: 'profile-box', height: 100, width: 100, top: 20, left: 50, transform: [-50, -50] }
  private profileTopRight: any = { name: 'profile-box', height: 100, width: 100, top: 20, left: 80, transform: [-50, -50] }

  async mounted () {
    this.$nextTick(() => {
      window.addEventListener('resize', () => {
        this.updateSizes()
      })
    })
    this.userMedia = await navigator.mediaDevices.getUserMedia({ video: true, audio: false })

    setTimeout(() => {
      const video: HTMLVideoElement = document.getElementsByClassName('video')[0] as HTMLVideoElement
      const canvas: HTMLCanvasElement = document.getElementsByClassName('canvas')[0] as HTMLCanvasElement
      const targetSquare: HTMLDivElement = document.getElementsByClassName('profile-box')[0] as HTMLDivElement
      const targetDims = targetSquare.getBoundingClientRect()
      canvas.height = targetDims.height
      canvas.width = targetDims.width
      console.log(canvas.width, canvas.height)
      console.log(video.videoWidth, video.videoHeight)
      const ctx = canvas.getContext('2d')
      ctx!.drawImage(video, targetDims.left, targetDims.top, targetDims.width, targetDims.height, 0, 0, targetDims.width, targetDims.height)
      window.open(canvas.toDataURL())
    }, 3000)
  }

  private updateSizes (): void {
    this.winHeight = window.innerHeight
    this.winWidth = window.innerWidth
  }

  private profileToStyle (profile: { height: number, width: number, top: number, left: number, transform: number[] }): string {
    return `height: ${profile.height}px; min-height: ${profile.height}px; width: ${profile.width}px; min-width: ${profile.width}px; top: ${profile.top}%; left: ${profile.left}%; transform: translate(${profile.transform[0]}%, ${profile.transform[1]}%)`
  }

  @Watch('userMedia')
  private userMediaWatcher () {
    this.$refs.video.srcObject = this.userMedia
  }
}
</script>

<style>
.container--fluid {
  height: 100%;
  overflow: hidden;
}

.video-wrapper {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 100%;
  height: 100%; 
  overflow: hidden;
}

.video-wrapper video {
  min-width: 100%; 
  min-height: 100%; 

  width: auto;
  height: auto;

  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%,-50%);
}

.canvas {
  position: absolute;
  /* width: 480px; */
  /* height: 640px; */
}

.profile-box{
  position: absolute;
  border: 2px solid purple;
}
</style>


Get this bounty!!!

#StackBounty: #javascript #html #dom #xpath JavaScript evaluate XPATH within an element?

Bounty: 50

I am trying to get an element using document.evaluate() but also want to search only within a specific element. So for example:

const element = document.evaluate('.//p', ...); //I want this to return the Hello, World p element
<html>
  <body>
    <div id="someId">
      <p>Hello, World!<p>
    </div>
  </body>
</html>

Is there any way I could pass in the div with id someId into the evaluate to only search within that scope?

I know I could write the whole XPATH like .//div[@id="someId"]/p (Wouldnt work for my case) or do string concatenation but would like to find a cleaner way of doing it like passing the DOM element (or some object it contains) somewhere.


Get this bounty!!!

#StackBounty: #html #css #flexbox #css-grid css grid vs flexbox : why does css grid cause repaints and flexbox not

Bounty: 50

I like very much css grid because of its simplicity. But there seems to be a performance issue with css grid that flexbox does not have.

I have implemented a two column full screen page both columns having a form with input box and a list of items with overflow-y:auto. One example where the left and right panel are implemented using flexbox and one where left and right panel are implemented with css grid.

this is the flexbox version : https://web-platform-wtfgmj.stackblitz.io/

and this is the css grid version : https://web-platform-wtfgmj.stackblitz.io/index2.html

Open the developper tools in chrome and enable paint flashing (tools/rendering has to be enabled).
When typing in one of the input boxes, the css grid version will repaint all items in the list. The flexbox version does not have this problem.

I would like to understand why css grid repaints all items in the list when typing in the input box ? And can it somehow be avoided ?

Update : Seems to be problem with stackblitz…
included as code snippets

html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
}
ol,
ul {
  list-style: none;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: border-box;
  box-shadow: none;
}
my-app {
  display: flex;
  flex-flow: column;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 0, 0, 0.1);
}

.header {
  display: grid;
  grid-template-columns: 3fr 7fr;
  grid-template-rows: 1em;
  gap: 0.6em;
  align-items: flex-start;
  margin: 1em;
}

.itemspanel {
  display: flex;
  flex: 1 1 auto;
  flex-flow: column;
  min-height: 0;
}

.itemheader {
  flex: 0 0 auto;
}

.items {
  flex: 1 1 auto;
  display: flex;
  flex-flow: column;
  overflow-y: auto;
  min-height: 0;
}

.itemrow {
  display: flex;
  flex-wrap: wrap;
  padding-bottom: 1em;
}
.itemrow > span:nth-child(1) {
  flex-basis: 30%;
  flex-grow: 1;
}
.itemrow > span:nth-child(2) {
  flex-basis: 70%;
  flex-grow: 1;
}

.itemrowgrid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  padding: 0 0.5em 1em 0.5em;
}

.panels {
  flex: 1 1 100%;
  display: grid;
  grid-template:
    "left right" 1fr
    / 1fr 2fr;
  gap: 1em;
  min-height: 0;
}
.panelleft {
  display: flex;
  flex-flow: column;
  grid-area: left;
  min-height: 0;
}
.panelright {
  display: flex;
  flex-flow: column;
  grid-area: right;
  min-height: 0;
}
<html>
<head>
  <meta charset="UTF-8">
</head>
<body>
  <my-app ng-version="11.0.8">
    <div class="panels">
      <div class="panelleft">
        <form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-touched ng-dirty">
          <label >Search:</label><input  type="text" name="name" ng-reflect-name="name" ng-reflect-model="00000" class="ng-valid ng-touched ng-dirty"><label ></label><button  type="button">Search</button>
        </form>
        <div class="itemspanel">
          <div class="itemheader"></div>
          <div class="items">
            <div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
            <div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
            <div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
            <div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
            <div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
            <div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
            <div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
            <div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
            <div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
            <div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
            <div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
            <div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
            <div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
            <div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
            <div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
            <div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
            <div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
            <div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
            <div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
            <div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
            <div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
            <div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
            <div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
            <div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
            <div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
            <div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
            <div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
            <div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
            <div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
            <div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
            <div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
            <div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
            <div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
            <div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
            <div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
            <div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
            <div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
            <div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
            <div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
            <div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
            <div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
            <div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
            <div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
            <div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
            <div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
            <div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
            <div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
            <div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
            <div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
            <div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
          </div>
        </div>
      </div>
      <div class="panelright d2">
        <form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-dirty ng-touched">
          <label >Search:</label><input  type="text" name="name1" ng-reflect-name="name1" ng-reflect-model="0000" class="ng-valid ng-dirty ng-touched"><label ></label><button  type="button">Search</button>
        </form>
        <div class="itemspanel">
          <div class="itemheader"></div>
          <div class="items">
            <div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
            <div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
            <div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
            <div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
            <div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
            <div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
            <div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
            <div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
            <div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
            <div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
            <div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
            <div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
            <div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
            <div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
            <div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
            <div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
            <div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
            <div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
            <div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
            <div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
            <div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
            <div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
            <div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
            <div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
            <div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
            <div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
            <div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
            <div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
            <div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
            <div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
            <div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
            <div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
            <div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
            <div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
            <div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
            <div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
            <div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
            <div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
            <div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
            <div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
            <div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
            <div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
            <div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
            <div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
            <div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
            <div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
            <div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
            <div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
            <div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
            <div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
          </div>
        </div>
      </div>
    </div>

  </my-app>
</body>

</html>
html,
body,
div,
span,
applet,
object,
iframe,
h1,
h2,
h3,
h4,
h5,
h6,
p,
blockquote,
pre,
a,
abbr,
acronym,
address,
big,
cite,
code,
del,
dfn,
em,
img,
ins,
kbd,
q,
s,
samp,
small,
strike,
strong,
sub,
sup,
tt,
var,
b,
u,
i,
center,
dl,
dt,
dd,
ol,
ul,
li,
fieldset,
form,
label,
legend,
table,
caption,
tbody,
tfoot,
thead,
tr,
th,
td,
article,
aside,
canvas,
details,
embed,
figure,
figcaption,
footer,
header,
hgroup,
menu,
nav,
output,
ruby,
section,
summary,
time,
mark,
audio,
video {
  margin: 0;
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
menu,
nav,
section {
  display: block;
}
body {
  line-height: 1;
}
ol,
ul {
  list-style: none;
}
blockquote,
q {
  quotes: none;
}
blockquote:before,
blockquote:after,
q:before,
q:after {
  content: "";
  content: none;
}
table {
  border-collapse: collapse;
  border-spacing: 0;
}

html {
  box-sizing: border-box;
}
*,
*:before,
*:after {
  box-sizing: border-box;
  box-shadow: none;
}



my-app {
  display: flex;
  flex-flow: column;
  width: 100vw;
  height: 100vh;
  background-color: rgba(255, 0, 0, 0.1);
}

.header {
  display: grid;
  grid-template-columns: 3fr 7fr;
  grid-template-rows: 1em;
  gap: 0.6em;
  align-items: flex-start;
  margin: 1em;
}

.itemspanel {
  display: flex;
  flex: 1 1 auto;
  flex-flow: column;
  min-height: 0;
}

.itemheader {
  flex: 0 0 auto;
}

.items {
  flex: 1 1 auto;
  display: flex;
  flex-flow: column;
  overflow-y: auto;
  min-height: 0;
}

.itemrow {
  display: flex;
  flex-wrap: wrap;
  padding-bottom: 1em;
}
.itemrow > span:nth-child(1) {
  flex-basis: 30%;
  flex-grow: 1;
}
.itemrow > span:nth-child(2) {
  flex-basis: 70%;
  flex-grow: 1;
}

.itemrowgrid {
  display: grid;
  grid-template-columns: 1fr 2fr;
  padding: 0 0.5em 1em 0.5em;
}

.panels {
  flex: 1 1 100%;
  display: flex;
  flex-flow: row;
  min-height: 0;
}
.panelleft,
.panelright {
  display: flex;
  flex-flow: column;
  min-height: 0;
}

.panelleft {
  flex: 1 1 100%;
}
.panelright {
  flex: 1 1 200%;
}
<html>
<head>
  <meta charset="UTF-8">
  <link rel="stylesheet" type="text/css" href="reset.css">
  <link rel="stylesheet" type="text/css" href="style1.css">
</head>
<body>
  <my-app ng-version="11.0.8">
    <div class="panels">
      <div class="panelleft">
        <form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-touched ng-dirty">
          <label >Search:</label><input  type="text" name="name" ng-reflect-name="name" ng-reflect-model="00000" class="ng-valid ng-touched ng-dirty"><label ></label><button  type="button">Search</button>
        </form>
        <div class="itemspanel">
          <div class="itemheader"></div>
          <div class="items">
            <div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
            <div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
            <div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
            <div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
            <div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
            <div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
            <div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
            <div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
            <div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
            <div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
            <div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
            <div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
            <div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
            <div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
            <div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
            <div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
            <div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
            <div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
            <div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
            <div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
            <div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
            <div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
            <div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
            <div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
            <div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
            <div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
            <div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
            <div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
            <div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
            <div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
            <div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
            <div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
            <div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
            <div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
            <div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
            <div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
            <div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
            <div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
            <div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
            <div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
            <div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
            <div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
            <div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
            <div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
            <div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
            <div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
            <div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
            <div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
            <div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
            <div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
          </div>
        </div>
      </div>
      <div class="panelright d2">
        <form novalidate="" name="frmFilters" autocomplete="off" class="header ng-valid ng-dirty ng-touched">
          <label >Search:</label><input  type="text" name="name1" ng-reflect-name="name1" ng-reflect-model="0000" class="ng-valid ng-dirty ng-touched"><label ></label><button  type="button">Search</button>
        </form>
        <div class="itemspanel">
          <div class="itemheader"></div>
          <div class="items">
            <div class="itemrowgrid"><span >Joelynn</span><span >Hitzmann</span></div>
            <div class="itemrowgrid"><span >Farris</span><span >Espine</span></div>
            <div class="itemrowgrid"><span >Linnet</span><span >Nare</span></div>
            <div class="itemrowgrid"><span >Heidie</span><span >Coolican</span></div>
            <div class="itemrowgrid"><span >Ulrike</span><span >Lowndsborough</span></div>
            <div class="itemrowgrid"><span >Claudine</span><span >Caneo</span></div>
            <div class="itemrowgrid"><span >Janella</span><span >Thurborn</span></div>
            <div class="itemrowgrid"><span >Menard</span><span >Wolledge</span></div>
            <div class="itemrowgrid"><span >Alasteir</span><span >Annandale</span></div>
            <div class="itemrowgrid"><span >Isabelita</span><span >Byrom</span></div>
            <div class="itemrowgrid"><span >Jim</span><span >Issard</span></div>
            <div class="itemrowgrid"><span >Mic</span><span >Tiddeman</span></div>
            <div class="itemrowgrid"><span >Carce</span><span >McClunaghan</span></div>
            <div class="itemrowgrid"><span >Archibaldo</span><span >Jacqueme</span></div>
            <div class="itemrowgrid"><span >Sybilla</span><span >Vivyan</span></div>
            <div class="itemrowgrid"><span >Herve</span><span >Lund</span></div>
            <div class="itemrowgrid"><span >Wade</span><span >Calway</span></div>
            <div class="itemrowgrid"><span >Irita</span><span >Newvell</span></div>
            <div class="itemrowgrid"><span >Lucie</span><span >Hurrion</span></div>
            <div class="itemrowgrid"><span >Sherie</span><span >Bapty</span></div>
            <div class="itemrowgrid"><span >Estella</span><span >Lettington</span></div>
            <div class="itemrowgrid"><span >Lion</span><span >Ganforthe</span></div>
            <div class="itemrowgrid"><span >Siouxie</span><span >January 1st</span></div>
            <div class="itemrowgrid"><span >Clay</span><span >Knightsbridge</span></div>
            <div class="itemrowgrid"><span >Shir</span><span >Desesquelle</span></div>
            <div class="itemrowgrid"><span >Magda</span><span >Brew</span></div>
            <div class="itemrowgrid"><span >Didi</span><span >Scanlon</span></div>
            <div class="itemrowgrid"><span >Petr</span><span >Clerk</span></div>
            <div class="itemrowgrid"><span >Frazier</span><span >Harler</span></div>
            <div class="itemrowgrid"><span >Deonne</span><span >Scoffham</span></div>
            <div class="itemrowgrid"><span >Meggi</span><span >Klampk</span></div>
            <div class="itemrowgrid"><span >Darby</span><span >Huey</span></div>
            <div class="itemrowgrid"><span >Berna</span><span >Batram</span></div>
            <div class="itemrowgrid"><span >Ashli</span><span >Ducarel</span></div>
            <div class="itemrowgrid"><span >Marilin</span><span >Gothup</span></div>
            <div class="itemrowgrid"><span >Mariya</span><span >Fettis</span></div>
            <div class="itemrowgrid"><span >Anett</span><span >Stookes</span></div>
            <div class="itemrowgrid"><span >Adella</span><span >Wash</span></div>
            <div class="itemrowgrid"><span >Ricky</span><span >Pellamonuten</span></div>
            <div class="itemrowgrid"><span >Nora</span><span >Hourigan</span></div>
            <div class="itemrowgrid"><span >Pancho</span><span >Wynn</span></div>
            <div class="itemrowgrid"><span >Magdaia</span><span >Walthall</span></div>
            <div class="itemrowgrid"><span >Thatch</span><span >Llorente</span></div>
            <div class="itemrowgrid"><span >Margaretta</span><span >Ramiro</span></div>
            <div class="itemrowgrid"><span >Jacques</span><span >Smallacombe</span></div>
            <div class="itemrowgrid"><span >Gamaliel</span><span >Learoyd</span></div>
            <div class="itemrowgrid"><span >Jyoti</span><span >Sholl</span></div>
            <div class="itemrowgrid"><span >Elbertine</span><span >Larwell</span></div>
            <div class="itemrowgrid"><span >Sebastian</span><span >Alvarado</span></div>
            <div class="itemrowgrid"><span >Mart</span><span >Hentzeler</span></div>
          </div>
        </div>
      </div>
    </div>

  </my-app>
</body>

</html>


Get this bounty!!!

#StackBounty: #html #css #vue.js #css-multicolumn-layout CSS display list in columns

Bounty: 50

I have a list which is made by Vue.js

Here is my code:

<ul>
    <li
        v-for="category in item.children"
        :key="category.id"
        class="menu-item"
    >
        <nuxt-link
            :to="
                localePath(
                    `/category/${category.slug}/${category.id}`
                )
            "
        >
            <h5>{{ category.lang[0].name }}</h5>
        </nuxt-link>
        <ul class="mega-menu__list">
            <li
                v-for="subItem in category.children"
                :key="subItem.id"
            >
                <nuxt-link
                    :to="
                        localePath(
                            `/category/${subItem.slug}/${subItem.id}`
                        )
                    "
                >
                    {{ subItem.lang[0].name }}
                </nuxt-link>
            </li>
        </ul>
    </li>
</ul>

enter image description here

But I want it to display like this which child is in the same column:

enter image description here

Any help is appreciated.


Get this bounty!!!

#StackBounty: #javascript #html #json HTML parser written in JavaScript that takes in strings and output a DOM tree object

Bounty: 50

I wrote an HTML parser in JavaScript, where it takes an a string that represents the HTML

const html = 
`<div>
<div>
foo
</div>
<div>
bar
</div>
</div>`

And it should output an object like this

{
    children: [
      { children: ['foo'], value: 'div' },
      { children: ['bar'], value: 'div' },
    ],
    value: 'div',
  }

here is my attempt

function parser(html) {
  const tokens = html.split('n')
  const stack = []
  tokens.forEach((token) => {
    if (token === '</div>') {
      const children = []
      while (stack[stack.length - 1] !== '<div>') {
        children.unshift(stack.pop()) 
      }
      stack.pop()
      stack.push({
        children,
        value: 'div',
      })
    } else {
      stack.push(token)
    }
  })
  return stack.pop()
}

My questions are:

  1. How can I modify the code so it can become easily expandable for other HTML tag body, div, span etc.
  2. Right now the HTML string it takes has to be valid. How can I modify the code so it can detect invalid HTML
  3. Right now the HTML string it takes doesn’t have any indentation. How can I modify the code so it can allow indentations in the input strings?


Get this bounty!!!

#StackBounty: #html #python-3.x #request #grequests Extracting Text From Asynchronus Request Using grequests

Bounty: 50

I am trying to extract the text part from the request that I made through grequest library but I am unable to figure out how can I do so.

If we use Requests Library I would do

r = requests.get('www.google.com')
htmls.append(r.text)

Now if I am using grequests I can only get a list of response code and not text.

rs = (grequests.get(u) for u in urls)
result = grequests.map(rs)

What I’ve tried
result = grequests.map(rs.text)

I get an error using above piece of code AttributeError: 'generator' object has no attribute 'text'

My desired output is a list of html text where response code is 200 else the value should be None.
How can I achieve that?

Desired Output:

response_code = [<Response [200]>,<Response [404]>,<Response [200]>]
htmls = ['html1', None, 'html2']


Get this bounty!!!

#StackBounty: #javascript #html Make a div visible on full screen of another div

Bounty: 100

I made an element take full screen by using the below method:

if (element.requestFullscreen) {
  element.requestFullscreen();
} else if (element.msRequestFullscreen) {
  element.msRequestFullscreen();
} else if (element.mozRequestFullScreen) {
  element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
  element.webkitRequestFullscreen();
} else {
  return;
}

It works well but I want to show another element when on the fullscreen mode.

The other element has position: fixed and z-index: 999999999 but it’s not visible when on fullscreen mode.

Could anyone help me, please?

Below is the link to the example

https://stackblitz.com/edit/web-platform-z1phjd?file=index.html

So I want to show the blue element when the red element is full screen sized.


Get this bounty!!!

#StackBounty: #html #visual-studio-code How Launch Multiple HTML files in Visual Studio Code?

Bounty: 50

I am trying to launch HTML multiple files in the same folder, and open them in Chrome (not a new window with every file) in Visual Studio Code. I tried this solution: Multiple Launch Files in Visual Studio Code, but I think, I am missing something.

I always get the message to close my current debug session before starting a new one.

Here is my launch.json file for the folder:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Chrome1",
            "request": "launch",
            "type": "pwa-chrome",
            "webRoot": "${workspaceFolder}",
            "file":"${file}"
        },
        {
            "name": "Chrome2",
            "request": "launch",
            "type": "pwa-chrome",
            "webRoot": "${workspaceFolder}",
            "file": "${file}"
        },
        {
            "name": "Chrome3",
            "request": "launch",
            "type": "pwa-chrome",
            "webRoot": "${workspaceFolder}",
            "file": "${file}"
        }
    ],
        "compounds": [
            {
              "name": "Chrome1/Chrome2/Chrome3",
              "configurations": ["Launch Chrome","Launch Chrome","Launch Chrome"],
              "preLaunchTask": "${defaultBuildTask}"
            }
        ]
}

Thanks!


Get this bounty!!!