Page MenuHomePhabricator

moving/copying references in VisualEditor causes them to get swapped sometimes
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Create/edit a Wikipedia article.
  • Do a lot of the following:
    • Add a citation.
    • Copy or cut, then paste a reference, sometimes multiple times. Sometimes the reference is of the form <ref>...</ref>, sometimes <ref name="foo">...</ref>, and sometimes <ref name="foo" />.
    • Drag and drop a reference.
    • Delete a citation.
    • Switch to source editing and then back to visual editing. I don't think I modified any of the citations, but it's possible.

What happens?:

Sometimes some of the references will trade places.

What should have happened instead?:

I don't care what the internal names are or which reference is the primary one, but the references (as defined by their contents) should remain attached to the article text I put them with.

Software version (skip for WMF-hosted wikis like Wikipedia):

Wikipedia, whatever versions were used on 28 September 2023 (currently today).

Other information (browser name/version, screenshots, etc.):

Browser info:

  • Name: Firefox
  • Version: 118.0
  • Build ID: 20230918143747
  • Distribution ID:
  • Update Channel: release
  • User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:109.0) Gecko/20100101 Firefox/118.0
  • OS: Windows_NT 10.0 19045
  • Extensions that are most likely to be relevant:
    • Dark Reader, version 4.9.66
    • uBlock Origin, version 1.52.2

Here's a screenshot demonstrating the issue. The source shown next to the quote is not the source I put next to the quote.

Screenshot 2023-09-28 214818.png (1×1 px, 211 KB)

I am proficient in JavaScript, and I have experience finding edge cases, but I'm having trouble finding the relevant part of the code between all the codebases (MediaWiki, VisualEditor, and Citoid, as far as I'm aware), but if you point me to the relevant code, I'm happy to try to help.

P.S. I had a possibly better description, but I included an image, and decided to click on it in the preview to double-check it, and it loaded in the same tab, and when I went back, I lost everything I typed here...

Event Timeline

P.S. I'm not sure what level it happens at, since some of the usages of the same references are correct. Also, note that I mostly tried to keep the references sorted by number, but there are some places where I intentionally chose a different ordering, to roughly match up with the order the statements are in the text.

In case it helps, here is an earlier version of the Wikitext of the article, that is probably correct. Unfortunately, the buggy references I found had not yet been added...

{{Orphan|date=April 2016}}
{{Lead extra info|date=September 2023}}

{{UStaxation}}

The '''Unauthorized Substances Tax''', nicknamed the "'''[[Crack cocaine|crack]] tax'''", was a Tennessee law designed to tax illegal drugs.<ref name=":0">{{Cite court|litigants=Steven Waters, et al. v. Reagan Farr, Commissioner of Revenue for the State of Tennessee|court=Supreme Court of Tennessee at Knoxville|reporter=Tennessee Administrative Office of the Courts|opinion=E2006-02225-SC-R11-CV|date=May 7, 2008|postscript=. Filed July 24, 2009. Majority opinion by Gary R. Wade: [https://www.tncourts.gov/courts/supreme-court/opinions/2009/07/24/steven-waters-et-al-v-reagan-farr-commissioner-revenue metadata], [http://www.tncourts.gov/sites/default/files/OPINIONS/TSC/PDF/093/Steven%20Waters%20v%20Reagan%20Farr%2C%20Commissioner%20of%20TN%20Dept%20of%20%20Revenue%20OPN.pdf PDF]. Minority opinion by William C. Koch, Jr.: [https://www.tncourts.gov/courts/supreme-court/opinions/2009/07/24/steven-waters-et-al-v-reagan-farr-commissioner-revenue-0 metadata], [http://www.tncourts.gov/sites/default/files/OPINIONS/TSC/PDF/093/Steven%20Waters%20v%20Reagan%20Farr%2C%20Commissioner%20of%20TN%20Dept%20of%20Revenue%20SC%20DIS.pdf PDF]. [https://casetext.com/case/waters-v-farr Casetext] cites it as 291 S.W.3d 873 (Tenn. 2009).}}</ref> It allowed drug dealers to anonymously purchase stamps from the Department of Revenue; someone arrested with a large enough amount of an unauthorized substance that didn't have a stamp on it would be required to pay back taxes and penalties.<ref name=":4" /><ref name="NC5" /><ref>{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2805 - Issuance of stamps to indicate payment of tax Report of seizure of unauthorized substances. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2805/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref>

It was modeled after a law in North Carolina<ref name=":4" /><ref name=":3" />; about 22 other states have similar laws.<ref name="NC5" />

It was passed by the [[Tennessee General Assembly]] on May 20, 2004 as chapter 803 of 2004 Tennessee Public Acts 1840, and took effect on January 1, 2005 as Part 28 "Taxation of Unauthorized Substances" of Chapter 4 "Privilege and Excise Taxes" of Title 67 "Taxes And Licenses" of the Tennessee Code.<ref name=":0" /><ref>{{Cite web |date=June 22, 2004 |title=CUMULATIVE INDEX - 2004, Public Chapters 419 - 959 |url=http://sharetngov.s3.amazonaws.com/sos/acts/103/pub/pcindex04.pdf |access-date=September 28, 2023 |publisher=State of Tennessee, Department of State, Division of Publications |publication-place=Nashville, Tennessee}}</ref><ref>{{Cite web |title=Tennessee Code Unannotated – Free Public Access |url=https://advance.lexis.com/container?config=014CJAA5ZGVhZjA3NS02MmMzLTRlZWQtOGJjNC00YzQ1MmZlNzc2YWYKAFBvZENhdGFsb2e9zYpNUjTRaIWVfyrur9ud&crid=f15a5dab-8543-437b-a8ac-aa4a2dfa1681&prid=993a3700-f907-406a-93f7-dd9d8cb65416 |access-date=September 28, 2023 |website= |via=LexisNexis}}</ref><ref>{{Cite web |title=Tenn. Code Ann. § 67-4-2801 |url=https://advance.lexis.com/documentpage/?pdmfid=1000516&crid=6c081bce-7670-4936-b62b-71cb4758439c&nodeid=ACOAAEABCAAB&nodepath=/ROOT/ACO/ACOAAE/ACOAAEABC/ACOAAEABCAAB&level=4&haschildren=&populated=false&title=67-4-2801.+Purpose.&config=025054JABlOTJjNmIyNi0wYjI0LTRjZGEtYWE5ZC0zNGFhOWNhMjFlNDgKAFBvZENhdGFsb2cDFQ14bX2GfyBTaI9WcPX5&pddocfullpath=/shared/document/statutes-legislation/urn:contentItem:4X8K-Y830-R03N-53NF-00008-00&ecomp=7gf5kkk&prid=f15a5dab-8543-437b-a8ac-aa4a2dfa1681 |access-date=September 28, 2023 |website= |via=LexisNexis}}</ref><ref>{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2801 - Purpose. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2801/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref>

The drugs taxed are [[Controlled substance|controlled substances]]<ref name=":1">{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2802 - Part definitions. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2802/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref><ref name=":2">{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2803 - Excise tax rates Methods of measuring quantities. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2803/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref> (such as [[Anabolic steroid|anabolic steroids]]<ref name=":1" />, [[Depressant|depressants]]<ref name=":1" />, [[Hallucinogen|hallucinogenic substances]]<ref name=":1" />, [[Stimulant|stimulants]]<ref name=":1" />, [[cocaine]]<ref name=":2" /><ref name="NC5">{{cite web |last=Moery |first=Sophie |date=September 7, 2007 |title=Court: Taxing Illegal Drugs Is Unconstitutional |url=http://www.newschannel5.com/story/7044396/court-taxing-illegal-drugs-is-unconstitutional |url-status=dead |archiveurl=https://web.archive.org/web/20120131141658/http://www.newschannel5.com/story/7044396/court-taxing-illegal-drugs-is-unconstitutional |archivedate=January 31, 2012 |accessdate=September 14, 2007 |website=NewsChannel 5 WTVF-TV |publication-place=Nashville TN}}</ref><ref name=":3">{{Cite news |date=July 24, 2009 |title=Supreme Court Rules Statute Taxing Unauthorized Substances Unconstitutional |work=The Chattanoogan |department=Breaking News |url=https://www.chattanoogan.com/2009/7/24/155500/Supreme-Court-Rules-Statute-Taxing.aspx |url-status=live |accessdate= |archiveurl=https://web.archive.org/web/20120117230632/http://www.chattanoogan.com/articles/article_155500.asp |archivedate=January 17, 2012}}</ref>, and certain parts of the [[Cannabis (drug)|marijuana]] plant<ref name=":1" /><ref name=":2" /><ref>{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2804 - Exemptions. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2804/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref>) and [[Moonshine|moonshine alcohol]]<ref name=":1" /><ref name=":2" /><ref name="NC5" /><ref>{{Cite news |date=September 8, 2007 |title=Court finds 'crack tax' unconstitutional |page=2 |work=The Victoria Advocate |agency=[[Associated Press|AP]] |publication-place=NASHVILLE, Tenn. |url=https://news.google.com/newspapers?nid=861&dat=20070908&id=EQJZAAAAIBAJ&sjid=BkYNAAAAIBAJ&pg=3034,4705060&hl=en |url-status=live |archive-url=http://web.archive.org/web/20230928161255/https://news.google.com/newspapers?nid=861&dat=20070908&id=EQJZAAAAIBAJ&sjid=BkYNAAAAIBAJ&pg=3034,4705060&hl=en |archive-date=September 28, 2023 |via=Google News Archive Search}}</ref>.

As of September 7, 2007, Tennessee had collected more than $6,000,000 in total, a lot of which came from confiscated property; just in 2006, they collected $1,800,000 from the tax.<ref name="NC5" />

== Waters v. Farr ==
In April of 2005, Steven Waters purchased nearly 1000 grams of cocaine from an undercover officer in Knox County. He was taxed according to this law, but refused to pay, so the Department of Revenue seized his bank accounts. In response, with the help of his lawyer Phil Lomonaco of Knoxville, he sued Reagan Farr, Commissioner of Revenue for the State of Tennessee.<ref name=":3" /><ref name=":4">{{Cite web |last=Humphrey |first=Tom |date=July 25, 2009 |title='Crack tax' shot down |url=http://www.knoxnews.com/news/local/crack-tax-shot-down-ep-409781502-359297691.html |access-date=September 28, 2023 |website=Knoxville News Sentinel |publisher=Gannett |place=Nashville |language=en}}</ref><ref name=":0" />

A [[Loudon County, Tennessee|Loudon County]] Chancery Court judge ruled the law unconstitutional.<ref name=":4" /> The three-judge Tennessee Court of Appeals upheld the ruling.<ref name=":4" /><ref name="NC5" /> 

==References==
<references/>

{{DEFAULTSORT:Crack Tax}}
[[Category:Personal taxes]]
[[Category:Drug control law in the United States]]
[[Category:Taxation in Tennessee]]

And here is the Wikitext after the glitch; it should correspond to what's shown in the screenshot:

{{Orphan|date=April 2016}}
{{Lead extra info|date=September 2023}}

{{UStaxation}}

The '''Unauthorized Substances Tax''', nicknamed the "'''[[Crack cocaine|crack]] tax'''", was a Tennessee law designed to tax illegal drugs.<ref name=":0">{{Cite court|litigants=Steven Waters, et al. v. Reagan Farr, Commissioner of Revenue for the State of Tennessee|court=Supreme Court of Tennessee at Knoxville|reporter=Tennessee Administrative Office of the Courts|opinion=E2006-02225-SC-R11-CV|date=May 7, 2008|postscript=. Filed July 24, 2009. Majority opinion by Gary R. Wade: [https://www.tncourts.gov/courts/supreme-court/opinions/2009/07/24/steven-waters-et-al-v-reagan-farr-commissioner-revenue metadata], [http://www.tncourts.gov/sites/default/files/OPINIONS/TSC/PDF/093/Steven%20Waters%20v%20Reagan%20Farr%2C%20Commissioner%20of%20TN%20Dept%20of%20%20Revenue%20OPN.pdf PDF]. Minority opinion by William C. Koch, Jr.: [https://www.tncourts.gov/courts/supreme-court/opinions/2009/07/24/steven-waters-et-al-v-reagan-farr-commissioner-revenue-0 metadata], [http://www.tncourts.gov/sites/default/files/OPINIONS/TSC/PDF/093/Steven%20Waters%20v%20Reagan%20Farr%2C%20Commissioner%20of%20TN%20Dept%20of%20Revenue%20SC%20DIS.pdf PDF]. [https://casetext.com/case/waters-v-farr Casetext] cites it as 291 S.W.3d 873 (Tenn. 2009).}}</ref> It allowed drug dealers to anonymously purchase stamps from the Department of Revenue; someone arrested with a large enough amount of an unauthorized substance that didn't have a stamp on it would be required to pay back taxes and penalties, or else their property could be confiscated<ref name=":4" /><ref name="NC5" /><ref>{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2805 - Issuance of stamps to indicate payment of tax Report of seizure of unauthorized substances. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2805/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref><ref name=":5">{{Cite web |date=September 28, 2007 |title=State officials to appeal ruling on 'crack tax' |url=https://www.actionnews5.com/story/7143898/state-officials-to-appeal-ruling-on-crack-tax |access-date=2023-09-28 |website=Action News 5 {{!}} WMC Memphis |publisher=Gray Media Group, Inc. / Gray Television, Inc. |place=NASHVILLE, Tenn. |language=en |agency=[[Associated Press]]}}</ref><ref name=":3" />; it occurs separately from any criminal case.

It was modeled after a law in North Carolina<ref name=":4" /><ref name=":3" />; about 22 other states have similar laws.<ref name="NC5" />

It was passed by the [[Tennessee General Assembly]] on May 20, 2004 as chapter 803 of 2004 Tennessee Public Acts 1840, and took effect on January 1, 2005 as Part 28 "Taxation of Unauthorized Substances" of Chapter 4 "Privilege and Excise Taxes" of Title 67 "Taxes And Licenses" of the Tennessee Code.<ref name=":0" /><ref>{{Cite web |date=June 22, 2004 |title=CUMULATIVE INDEX - 2004, Public Chapters 419 - 959 |url=http://sharetngov.s3.amazonaws.com/sos/acts/103/pub/pcindex04.pdf |access-date=September 28, 2023 |publisher=State of Tennessee, Department of State, Division of Publications |publication-place=Nashville, Tennessee}}</ref><ref>{{Cite web |title=Tennessee Code Unannotated – Free Public Access |url=https://advance.lexis.com/container?config=014CJAA5ZGVhZjA3NS02MmMzLTRlZWQtOGJjNC00YzQ1MmZlNzc2YWYKAFBvZENhdGFsb2e9zYpNUjTRaIWVfyrur9ud&crid=f15a5dab-8543-437b-a8ac-aa4a2dfa1681&prid=993a3700-f907-406a-93f7-dd9d8cb65416 |access-date=September 28, 2023 |website= |via=LexisNexis}}</ref><ref>{{Cite web |title=Tenn. Code Ann. § 67-4-2801 |url=https://advance.lexis.com/documentpage/?pdmfid=1000516&crid=6c081bce-7670-4936-b62b-71cb4758439c&nodeid=ACOAAEABCAAB&nodepath=/ROOT/ACO/ACOAAE/ACOAAEABC/ACOAAEABCAAB&level=4&haschildren=&populated=false&title=67-4-2801.+Purpose.&config=025054JABlOTJjNmIyNi0wYjI0LTRjZGEtYWE5ZC0zNGFhOWNhMjFlNDgKAFBvZENhdGFsb2cDFQ14bX2GfyBTaI9WcPX5&pddocfullpath=/shared/document/statutes-legislation/urn:contentItem:4X8K-Y830-R03N-53NF-00008-00&ecomp=7gf5kkk&prid=f15a5dab-8543-437b-a8ac-aa4a2dfa1681 |access-date=September 28, 2023 |website= |via=LexisNexis}}</ref><ref>{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2801 - Purpose. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2801/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref>

The drugs taxed are [[Controlled substance|controlled substances]]<ref name=":1">{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2802 - Part definitions. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2802/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref><ref name=":2">{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2803 - Excise tax rates Methods of measuring quantities. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2803/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref> (such as [[Anabolic steroid|anabolic steroids]]<ref name=":1" />, [[Depressant|depressants]]<ref name=":1" />, [[Hallucinogen|hallucinogenic substances]]<ref name=":1" />, [[Stimulant|stimulants]]<ref name=":1" />, [[cocaine]]<ref name="NC5">{{cite web |last=Moery |first=Sophie |date=September 7, 2007 |title=Court: Taxing Illegal Drugs Is Unconstitutional |url=http://www.newschannel5.com/story/7044396/court-taxing-illegal-drugs-is-unconstitutional |url-status=dead |archiveurl=https://web.archive.org/web/20120131141658/http://www.newschannel5.com/story/7044396/court-taxing-illegal-drugs-is-unconstitutional |archivedate=January 31, 2012 |accessdate=September 14, 2007 |website=NewsChannel 5 WTVF-TV |publication-place=Nashville TN}}</ref><ref name=":2" />, and certain parts of the [[Cannabis (drug)|marijuana]] plant<ref name=":1" /><ref name=":2" /><ref>{{Cite web |date=2010 |title=2010 Tennessee Code :: Title 67 - Taxes And Licenses :: Chapter 4 - Privilege and Excise Taxes :: :: Part 28 - Taxation of Unauthorized Substances :: :: 67-4-2804 - Exemptions. |url=https://law.justia.com/codes/tennessee/2010/title-67/chapter-4/part-28/67-4-2804/ |access-date=September 28, 2023 |website= |language= |via=Justia Law}}</ref>) and [[Moonshine|moonshine alcohol]]<ref name=":5" /><ref name=":3">{{Cite news |date=July 24, 2009 |title=Supreme Court Rules Statute Taxing Unauthorized Substances Unconstitutional |work=The Chattanoogan |department=Breaking News |url=https://www.chattanoogan.com/2009/7/24/155500/Supreme-Court-Rules-Statute-Taxing.aspx |url-status=live |accessdate= |archiveurl=https://web.archive.org/web/20120117230632/http://www.chattanoogan.com/articles/article_155500.asp |archivedate=January 17, 2012}}</ref><ref name=":1" /><ref name=":2" /><ref name="NC5" /><ref name=":6">{{Cite news |date=September 8, 2007 |title=Court finds 'crack tax' unconstitutional |page=2 |work=The Victoria Advocate |agency=[[Associated Press|AP]] |publication-place=NASHVILLE, Tenn. |url=https://news.google.com/newspapers?nid=861&dat=20070908&id=EQJZAAAAIBAJ&sjid=BkYNAAAAIBAJ&pg=3034,4705060&hl=en |url-status=live |archive-url=http://web.archive.org/web/20230928161255/https://news.google.com/newspapers?nid=861&dat=20070908&id=EQJZAAAAIBAJ&sjid=BkYNAAAAIBAJ&pg=3034,4705060&hl=en |archive-date=September 28, 2023 |via=Google News Archive Search}}</ref>.

As of September 7, 2007, Tennessee had collected more than $6,000,000 in total, a lot of which came from confiscated property; just in 2006, they collected $1,800,000 from the tax.<ref name="NC5" />

== Waters v. Farr ==
In April of 2005, Steven Waters purchased nearly 1000 grams of cocaine from an undercover officer in Knox County. He was taxed according to this law, but refused to pay, so the Department of Revenue seized his bank accounts. In response, with the help of his lawyer Phil Lomonaco of Knoxville, he sued Reagan Farr, Commissioner of Revenue for the State of Tennessee.<ref name=":3" /><ref name=":4">{{Cite web |last=Humphrey |first=Tom |date=July 25, 2009 |title='Crack tax' shot down |url=http://www.knoxnews.com/news/local/crack-tax-shot-down-ep-409781502-359297691.html |access-date=September 28, 2023 |website=Knoxville News Sentinel |publisher=Gannett |place=Nashville |language=en}}</ref><ref name=":0" />

A judge in the Chancery Court of [[Loudon County, Tennessee|Loudon County]] ruled the law unconstitutional.<ref name=":0" /><ref name=":4" /><ref name=":3" /> A three-judge panel in the Eastern Section of the Tennessee Court of Appeals unanimously upheld the ruling, stating that it exceeded the taxation power provided by Article II, Section 28 of the Tennessee Constitution;<ref name=":4" /><ref name="NC5" /><ref name=":5" /><ref name=":6" /> Judge Sharon G. Lee wrote the opinion, which stated that "Because it seeks to levy a tax on the privilege to engage in an activity that the Legislature has previously declared to be a crime, not a privilege, we must necessarily conclude that the drug tax is arbitrary, capricious and unreasonable, and therefore invalid under the constitution of this state."<ref name=":3" /> 

==References==
<references/>

{{DEFAULTSORT:Crack Tax}}
[[Category:Personal taxes]]
[[Category:Drug control law in the United States]]
[[Category:Taxation in Tennessee]]

I have noticed something that might be related: If I copy a reference and then paste it, it refers to the same entry in the reference list. But if I drag-and-drop another reference in between copying and pasting, it creates a new entry each time I paste.