margin take in account only the first time
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 5.9k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
Hi,
I'm stuck with a weird problem... I think it's a bug of the library.
I'm using jsBarcode to generate product labels
```html
TAG {{ product.tagNumber }}
PNR {{ product.material.uid }}
SER {{ product.serialNumber }}
```
```javascript
JsBarcode(document.getElementById("barcode1"))
.CODE128(`*RPO ${product.uid}*`, { height: 50, displayValue: false, margin: 0 })
.render();
JsBarcode(document.getElementById("barcode2"))
.CODE128(`*PNR ${product.material.uid}*`, { height: 50, displayValue: false, margin: 0 })
.render();
JsBarcode(document.getElementById("barcode3"))
.CODE128(`*SER ${product.serialNumber}*`, { height: 50, displayValue: false, margin: 0 })
.render();
```
Only the first generated barcode will have no margin
Other barcode will have default margin (10px)
If I switch the order, by example i generate the #barcode2 before the #barcode1, the #barcode2 will have no margin, and the 1 and 3 will have default margin...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue using the three JsBarcode(...).CODE128(...).render() calls shown, with margin: 0 on each barcode. Inspect how the margin option is retained between successive renders; done means all three generated barcodes have no margin, regardless of call order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100